Angularjs 应用程序url是..index.html#/signup,而不是..index.html#/signup
我正在构建一个AngularJS(1.4.7)应用程序。我的注册url应该是Angularjs 应用程序url是..index.html#/signup,而不是..index.html#/signup,angularjs,visual-studio-2013,Angularjs,Visual Studio 2013,我正在构建一个AngularJS(1.4.7)应用程序。我的注册url应该是…index.html/#/signup。但当我点击注册链接时,它会显示…index.html#/signup。单击“注册”按钮时,我的注册视图未加载 我的app.js文件: My index.html文件: 我的indexController: 'use strict' app.controller('indexController', ['$scope', '$location', 'authService', fu
…index.html/#/signup
。但当我点击注册链接时,它会显示…index.html#/signup
。单击“注册”按钮时,我的注册视图未加载
我的app.js文件:My index.html文件:
我的indexController:
'use strict'
app.controller('indexController', ['$scope', '$location', 'authService', function ($scope, $location, authService) {
$scope.logot = function () {
authService.logot();
$location.path('/home');
};
$scope.authentication = authService.authentication;
}]);
事实上,我在玩这篇博文:这里有一个非常简单的,但可以实现
ngRoute
的示例:
JavaScript
angular.module('testModule', ['ngRoute'])
.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when('/foo', {
template: '<p>Foo</p>'
})
.when('/bar', {
template: '<p>Bar</p>'
})
.when('/baz', {
template: '<p>Baz</p>'
})
.otherwise({
redirectTo: '/index.html'
});
}]);
angular.module('testModule',['ngRoute']))
.config(['$routeProvider',函数($routeProvider){
$routeProvider
。当(“/foo”{
模板:“Foo”
})
。当(“/bar”{
模板:“栏”
})
。当(“/baz”{
模板:“Baz”
})
.否则({
重定向到:'/index.html'
});
}]);
HTML
<body>
<a href="#foo">Go to foo</a><br>
<a href="#bar">Go to bar</a><br>
<a href="#baz">Go to baz</a><br>
<div ng-view></div>
</body>
虽然这不是答案,但它可以帮助我找出我在路线配置中犯的错误。实际上它应该是templateUrl
而不是urlTemplate