0
我試圖角路線
我有3個文件:
- 應用
- bearCtrl
- bearRoute
-apps:
var bearApp = angular.module('bearApp', ['ngRoute']);
-bearCtrl
bearApp.controller('bearCtrl',['$scope',function ($scope) {
$scope.bears = [
{
name:'Bear1'
,price:25
},
{
name:'Bear2'
,price:30
}
];
}]);
-bearRoute
bearApp.config(function($locationProvider, $routeProvider) {
$routeProvider
.when('/', {
templateUrl: '/template1.html',
controller: ''
})
.otherwise({
redirectTo: '/'
});
});
在我的HTML我有一個<div ng-view></div>
我得到這個錯誤,我不知道我做錯了什麼:
Uncaught Error: [$injector:modulerr]
聽起來好像您沒有包含'ngRoute'腳本文件。 – m59