$ routeProvider不明 [英] $routeProvider is unknown
本文介绍了$ routeProvider不明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经加入了脚本这样
<script src="Scripts/angular.js"></script>
<script src="Scripts/angular-route.min.js"></script>
<script src="Scripts/angular-resource.min.js"></script>
<script src="Scripts/test.js"></script>
和我这样做我的 test.js
var app = angular.module('MyApp', ['ngRoute']).config(function ($routeProvider) {
$routeProvider.when('/login', {
templateUrl: 'login.html',
controller: 'loginController'
});
$routeProvider.otherwise({ redirectTo: '/login' });
});
app.controller('loginController', function () {
})
我得到了$ routeProvider是未知的。
I got that the $routeProvider is unknown.
我看了一下这个很多问题,我尝试了解决方案,但没有什么工作。
I have read many questions about this and I tried the solutions but nothing works.
帮助,请
注意
角库工作我可以做,例如结合
note
the angular library is working I can make binding for example推荐答案
尝试
<div ng-app="MyApp" ng-controller="loginController">{{test}}</div>
然后
var app = angular.module('MyApp', ['ngRoute']).config(function ($routeProvider) {
$routeProvider.when('/login', {
templateUrl: 'login.html',
controller: 'loginController'
});
$routeProvider.otherwise({
redirectTo: '/login'
});
});
app.controller('loginController', function ($scope) {
$scope.test = "test me"
})
这篇关于$ routeProvider不明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文