javascript - AngularJS Routing not doing anything not working -
i have following phonecat tutorial combined angular seed project. come problem, can't routing work / load, no errors occur , seems fine. can't seem get, basic redirect work. i'm lost do.
here app.js think error is
'use strict'; var elgrossisten = angular.module('elgrossisten', [ 'ngroute', 'elgrossistencontrollers' ]); elgrossisten.config(['$routeprovider', function($routeprovider) { $routeprovider. when('/search', { templateurl: 'partials/elnrlist.html', controller: 'searchelnrctrl' }). otherwise({ redirectto: '/search' }); }]);
controller
var elgrossistencontrollers = angular.module('elgrossisten', []);
elgrossistencontrollers.controller('searchelnrctrl', function ($scope) { $scope.elnrs = [ {'elnr': '10150135', 'avgprice': '18.75', 'lastupdated': '01-01-2014'}, {'elnr': '10170135', 'avgprice': '18.75', 'lastupdated': '01-01-2014'}, {'elnr': '10110135', 'avgprice': '18.75', 'lastupdated': '01-01-2014'} ]; });
and how load scripts.
<script src="../bower_components/angular/angular.js"></script> <script src="../bower_components/angular-route/angular-route.js"></script> <script src="js/app.js"></script> <script src="js/services.js"></script> <script src="js/controllers.js"></script> <script src="js/filters.js"></script> <script src="js/directives.js"></script>
your elgrossisten
module depends on 2 others:
angular.module('elgrossisten', [ 'ngroute', 'elgrossistencontrollers' ]);
those 2 modules need defined before instantiate elgrossisten
module. maybe try loading scripts way?
<script src="../bower_components/angular/angular.js"></script> <script src="../bower_components/angular-route/angular-route.js"></script> <script src="js/controllers.js"></script> <script src="js/app.js"></script> <script src="js/services.js"></script> <script src="js/filters.js"></script> <script src="js/directives.js"></script>
you need include dependant modules before load app js (as 1 depends on others). although don't understand why no error showing you. if provide more information, or plnkr, out bit more.
Comments
Post a Comment