我这么写为啥不对呀
1.检测一下你的<script>标签 angular-route.js路径是否正确引入。
2.试着把你的路由改成下面这样?:
angular.module('myApp', ['ngRoute']).config(['$routeProvider',function($routeProvider)
{
$routeProvider
.when('/', {
templateUrl: 'xxx.html',
controller: 'xxxController'
})
.otherwise({
redirectTo: '/'
});
}]);
很久没有关注ng1.x版本了,问题原因stackoverflow上有,点这。
$inject的声明方式不对,如果显示的声明依赖注入关系的话,它应该是一个静态属性,所以应该是