My html codeļ¼
<script type="text/javascript" src="js/angular.min.js" ></script>
<script type="text/javascript" src="js/angular-route.min.js"></script>
<script type="text/javascript" src="mail.js" ></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
My JavaScript code:
var myapp=angular.module('mail', ['ngRoute']);
But I get
Uncaught Error: [$injector:modulerr]
Why?
Please load jquery library first then load angularjs library, then ngRouter library see following line
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/angular.min.js" ></script>
<script type="text/javascript" src="js/angular-route.min.js"></script>
<script type="text/javascript" src="mail.js" ></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
Load JS files in order jQuery>Bootstrap>angular>route>mail. Also verify the version number of angular, ng-route you are using in your application. If not sure, use cdn.
https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.17/angular.min.js
https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.17/angular-route.min.js
Related
I have one page index.html
I've made page with head:
<script src="/assets/javascripts/jquery.js"></script>
<script src="/assets/javascripts/underscore.js"></script>
<script src="/assets/javascripts/jquery-ui.js"></script>
<script src="/assets/javascripts/json2.js"></script>
<script src="/assets/javascripts/jquery.lazyload.js"></script>
<script src="/assets/javascripts/scrollstop.js"></script>
<script src="/assets/javascripts/backbone.js"></script>
<script src="/assets/javascripts/backbone/search.js"></script>
<script src="assets/javascripts/backbone/templates/filter.jst.ejs" type="text/template"></script>
<script src="/assets/javascripts/backbone/templates/item.jst.ejs" type="text/template"></script>
<script src="/assets/javascripts/backbone/templates/item_loading.jst.ejs" type="text/template"></script>
<script src="/assets/javascripts/backbone/templates/more.jst.ejs" type="text/template"></script>
<script src="/assets/javascripts/backbone/templates/razbor.jst.ejs" type="text/template"></script>
<script src="/assets/javascripts/backbone/templates/total.jst.ejs" type="text/template"></script>
<script src="/assets/javascripts/backbone/models/filter.js"></script>
<script src="/assets/javascripts/backbone/models/filter_value.js"></script>
<script src="/assets/javascripts/backbone/models/item.js"></script>
<script src="/assets/javascripts/backbone/models/more.js"></script>
<script src="/assets/javascripts/backbone/models/razbor.js"></script>
<script src="/assets/javascripts/backbone/models/search.js"></script>
<script src="/assets/javascripts/backbone/views/filter_view.js"></script>
<script src="/assets/javascripts/backbone/views/item_view.js"></script>
<script src="/assets/javascripts/backbone/views/razbor_view.js"></script>
<script src="/assets/javascripts/backbone/views/search_view.js"></script>
<script src="/assets/javascripts/backbone/routers/search_router.js"></script>
And chrome tells me:
Uncaught ReferenceError: JST is not defined
at filter_view.js:4
The line 4:
template: JST["backbone/templates/filter"],
What should I do without Rails to fix my problem?
Thanks for advises!
I know asking this is silly but I am stuck and not getting out of it. I am new to Angular.js and have created the following program but it is not running as the program can't find the script sources..I have tried all the possible ways but haven't found the solution.
<!DOCTYPE html>
<html ng-app="eventsApp">
<head>
</head>
<body>
<div ng-controller="EventController">
{{event.name}}
</div>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js" > </script>
<script type="text/javascript" src="/js/app.js"></script>
<script type="text/javascript" src="/js/controllers/EventController.js"></script>
</body>
</html>
Following is the snapshot of my folder arrangement:
I think you should remove the / before js in the src.if it is not working then check if it is the right path.
<script type="text/javascript" src="/js/app.js"></script>
<script type="text/javascript" src="/js/controllers/EventController.js"> </script>
Should Be
<script type="text/javascript" src="../js/app.js"></script>
<script type="text/javascript" src="../js/controllers/EventController.js"></script>
OR
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript" src="js/controllers/EventController.js"></script>
Depending on your location and path of js folder....
when im running my Ionic app inside iOS simulator,
and using the Safari Web inspector, i see this error:
file:///.../.../Application/.../myApp.app/www/lib/ionic/js/angular.min.js.map
Failed to load resource: The requested URL was not found on this server.
Anyone knows how to solve it?
Thanks.
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.min.js"></script>
<script src="lib/angular-resource/angular-resource.min.js"></script>
<script src="lib/ngstorage/ngStorage.min.js"></script>
<script src="lib/ngCordova/dist/ng-cordova.min.js"></script>
<!-- Libraries -->
<script src="lib/moment/min/moment.min.js"></script>
<script src="lib/ng-lodash/build/ng-lodash.min.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<!-- your app's js -->
<script src="js/app.js"></script>
<script src="js/constants.js"></script>
<script src="js/config.js"></script>
<script src="js/controllers.js"></script>
<script src="js/services.js"></script>
<script src="js/directives.js"></script>
</head>
</html>
I ended up importing ionic.bundle.js instead of ionic.bundle.min.js and the issue was gone
I only add two more files two more files at the end to scripts/Auth/authCtrl.js and scripts/Auth/authService.js
and all works on development but it says is missing all those files when running the dist. Please help me fins whats wrong thanks
BUG LINK
Ok I found the problem, it turns out that when I create the distribution application with grunt server:dist the index file was being copy over as it its and it did not have any reference of the minified files; so I replace all the script links for the ones minified only and all works now.
<script src="scripts/vendor.js"></script>
<script src="scripts/ui.js"></script>
<script src="scripts/app.js"></script>
instead of
<!-- build:js scripts/vendor.js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="bower_components/underscore/underscore.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<!-- endbuild -->
<!-- build:js scripts/ui.js -->
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="bower_components/jquery-spinner/dist/jquery.spinner.min.js"></script>
<script src="bower_components/seiyria-bootstrap-slider/dist/bootstrap-slider.min.js"></script>
<script src="bower_components/jquery-steps/build/jquery.steps.min.js"></script>
<script src="bower_components/toastr/toastr.min.js"></script>
<script src="bower_components/bootstrap-file-input/bootstrap.file-input.js"></script>
<script src="bower_components/jquery.slimscroll/jquery.slimscroll.min.js"></script>
<script src="bower_components/holderjs/holder.js"></script>
<script src="bower_components/raphael/raphael-min.js"></script>
<script src="bower_components/morris.js/morris.js"></script>
<script src="scripts/vendors/jquery.sparkline.min.js"></script>
<script src="bower_components/flot/jquery.flot.js"></script>
<script src="bower_components/flot/jquery.flot.resize.js"></script>
<script src="bower_components/flot/jquery.flot.pie.js"></script>
<script src="bower_components/flot/jquery.flot.stack.js"></script>
<script src="bower_components/flot.tooltip/js/jquery.flot.tooltip.min.js"></script>
<script src="bower_components/flot/jquery.flot.time.js"></script>
<script src="bower_components/gauge.js/dist/gauge.min.js"></script>
<script src="bower_components/jquery.easy-pie-chart/dist/angular.easypiechart.min.js"></script>
<script src="bower_components/angular-wizard/dist/angular-wizard.min.js"></script>
<script src="bower_components/textAngular/dist/textAngular-rangy.min.js"></script>
<script src="bower_components/textAngular/dist/textAngular-sanitize.min.js"></script>
<script src="bower_components/textAngular/dist/textAngular.min.js"></script>
<script src="bower_components/angular-local-storage/dist/angular-local-storage.min.js"></script>
<script src="scripts/vendors/skycons.js"></script>
<script src="bower_components/angular-loading-bar/build/loading-bar.min.js"></script>
<!-- endbuild -->
<!-- build:js({.tmp,client}) scripts/app.js -->
<script src="scripts/app.js"></script>
<script src="scripts/shared/main.js"></script>
<script src="scripts/shared/directives.js"></script>
<script src="scripts/shared/localize.js"></script>
<script src="scripts/UI/UICtrl.js"></script>
<script src="scripts/UI/UIDirective.js"></script>
<script src="scripts/UI/UIService.js"></script>
<script src="scripts/Form/FormDirective.js"></script>
<script src="scripts/Form/FormCtrl.js"></script>
<script src="scripts/Form/FormValidation.js"></script>
<script src="scripts/Table/TableCtrl.js"></script>
<script src="scripts/Task/Task.js"></script>
<script src="scripts/Chart/ChartCtrl.js"></script>
<script src="scripts/Chart/ChartDirective.js"></script>
<script src="scripts/Auth/authCtrl.js"></script>
<script src="scripts/Auth/authService.js"></script>
<!-- endbuild -->
I am using jquery mobile with phonegap and angular JS. When include jquery Mobile, then nothing shown in android mobile and when remove jquery mobile evry thing work but cannot pick jquery-mobile.css. i think there is jquery confliction.
all files are includes as
<script type="text/javascript" src="vendors/onsen/js/onsenui.js"></script>
<script type="text/javascript" src="js/angular-carousel.js"></script>
<script type="text/javascript"src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="js/lodash.underscore.min.js"></script>
<script type="text/javascript" src="js/angular-google-maps.min.js"></script>
<script type="text/javascript" src="js/event.js"></script>
<script type="text/javascript" src="js/ui-map.js"></script>
<script type="text/javascript" src="js/angular-local-storage.js"></script>
<script type="text/javascript" src="js/angular-sanitize.js"></script>
<!-- NVD3 re-usable charting library (based on D3) -->
<script type="text/javascript" src="js/nvd3/d3.min.js"></script>
<script type="text/javascript" src="js/nvd3/nv.d3.min.js"></script>
<script type="text/javascript" src="js/nvd3/angular-nvd3.min.js"></script>
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript" src="js/data.js"></script>
<script src="js/jquery-1.11.1.min.js"></script>
<!--- Imager Assets -->
<script type="text/javascript" src="js/custom/jquery.mobile.js"></script>
<script type="text/javascript" src="js/custom/jquery.vintage.js"></script>
<script type="text/javascript" src="js/custom/jquery.cropper.js"></script>
<script type="text/javascript" src="js/custom/spoon.js"></script>
<!--- Images Assets -->
<script type="text/javascript" src="cordova.js"></script>
Whats wrong with this.
any help will be appreciated.
use the phonegap developer app http://app.phonegap.com/, and connect the application using that app, the app have console, so that you can see exactly what wrong.
but as per my experience with PhoneGap+AngularJs+JQueryMobile, we have to choose either AngularJS or JqueryMobile both are not working together as expected. other wise choose appropriate modules of JqueryMobile and use them.