jadjoubran / laravel5-angular-material-starter

Get started with Laravel 5.3 and AngularJS (material)
https://laravel-angular.readme.io/
MIT License
1.66k stars 400 forks source link

3.3.0-beta: jQuery 2.2.4 throws error #355

Closed milocosmopolitan closed 8 years ago

milocosmopolitan commented 8 years ago

I'm trying to use bootstrap 3.3.6 which requires jQuery version higher than 1.9 and lower than 3.0.0 However when I include following code on index.blade.php

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>

I get this error. Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to: Error: [$injector:nomod] Module 'app' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

it seems to work with jQuery version 3

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>

But now bootstrap is not working... :(

flick36 commented 8 years ago

What version of the starter are you using? How are you serving the app? Why don't you use bower install jquery --save and modify your bower.json to have something like: "jquery": "~2.2.4" so it won install anything > than 2.2.4?

note that jquery should load before angular in this case so be sure jquery it's before angular in your bower.json

And if you want to use bootstrap here it's a fork that uses bootstrap already and some other goodies

milocosmopolitan commented 8 years ago

@flick36 I've just tried bower install jquery --save and made sure jquery is placed before angular, but still not able to make it work. I'm running 3.3.0-beta on homestead. I was able to use jquery version 2.2.4 on last stable version but not successful on new-beta version. It's not urgent matter, but I was wondering why injector error would appear when jquery 2.2.4 is used while jquery 3.0.0 working fine with starter 3.3.0-beta.

flick36 commented 8 years ago

@milocosmopolitan i've just create a new instance of the most recent version of the starter, with:

composer create-project jadjoubran/laravel5-angular-material-starter=3.3.0-beta --prefer-dist
npm install
bower install
bower install jquery#2.2.4 --save
gulp

and everything works just fine..

I've also delete that jquery instance from bower and delete the jquery folder it creates (the dependency) on bower_components and i did a

bower install bootstrap#3.3.6 --save
gulp

and everything work just fine as well... note that if you do this approach ^ jquery it's automatically inserted in your app because bower it's that smart to download jquery since it's a bootstrap dependency... as you mentioned

btw @jadjoubran i did all of the above with Laragon just to try what i suggest here: https://github.com/jadjoubran/laravel5-angular-material-starter/issues/290#issuecomment-230073483 (i've only have to configure the ssl) cause it was giving me some error message in the console about not being a trusted page

Uncaught (in promise) DOMException: Only secure origins are allowed (see: https://goo.gl/Y0ZkNV).

haven't seen the code yet but something ask for SSL am i right? anyway, first run was like 4.5-8 secs then.. 500-700 ms (browsers gives diffirent ranges but more or less it never goes beyond 700 probably 702 maybe xD) , and when i did the bower install then gulp, and was ready to refresh and saw that automaticall refresh with the there's a new version of the app i was like woooh! that's awesome :stuck_out_tongue_winking_eye: anyway i'll fully test it tomorrow

milocosmopolitan commented 8 years ago

@flick36 There must be something wrong with my code... Btw thanks for the link to ADMIN LTE! I think this will come very handy :)

followtheart commented 8 years ago

@flick36 Same issue

Uncaught (in promise) DOMException: Only secure origins are allowed (see: https://goo.gl/Y0ZkNV).

have you get this solved,Can you share how to fix it?

flick36 commented 8 years ago

@followtheart that's just a Chrome alert for security reasons if you follow the link you'll notice it says

Chrome is going to make Service Workers available only to secure origins

Adn Service Wrokers are the new feature we are talking about in this new version so, the "solution" is to either run your server locally with localhost since localhost it's an exception of that rule, or with an SSL certificate. you can make your own depending on what are you using to serve your app, in my case i use Laragon or XAMPP and there are a lot of tutorials of how you can enable ssl in those enviorements, and actually anyone you use.