Moving From Ng-include To Ngroute
I am new to Angular and learned the basics about it recently. In my current project, I am developing a single page application. As of now, my HTML/JS setup is as per below: HTML: &
Solution 1:
Config section is incorrect. Instead of
.config(['$routeProvider', '$locationProvider'], function($routeProvider, $locationProvider) { ... });
it should be
.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { ... }]);
Note, that function definition belongs to array object.
Another mistake is in redirectTo
property of the drawer
route, currently it doesn't make sense. You want probably this instead:
.when('/drawer', {
templateUrl: 'src/includes/drawer.html',
controller: 'drawerCtrl'
})
Solution 2:
Ensue that you have added the angular-route.js
file to the html file.
And you are missing the ngRoute module here -
var app = angular.module('MyApp',['ngRoute','ngResource' ]);
app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider){... }]);
dfsq is correct. There are syntax errors in the code.
Post a Comment for "Moving From Ng-include To Ngroute"