我不确定如何在web api应用程序中实现正确的角度路由.我可以使用这种方法打开页面:
http://localhost:52876/HTML/app/borrower.html
角度控制器加载精细,角度侧的所有功能都在那里.
现在,我希望能够使用ng-route以更好的视图打开视图,因此例如http://localhost:52876/HTML/app/borrower.html将成为
http://localhost:52876/borrower.
我在我的角度应用程序中使用的html文件中包含了ng-route.js文件.
同样在app.js我有这个:
'use strict'; var modules = [ 'app.controllers','LoanAdminApplicationController','ngCookies','ngResource','ngSanitize','ngRoute','ui.router','LocalStorageModule','angular-loading-bar' ]; var app = angular.module('app',modules); app.config(function ($routeProvider,$locationProvider) { $locationProvider.html5Mode(true); $routeProvider.when("/home",{ controller: "homeController",templateUrl: "/app/views/home.html" }); $routeProvider.when("/login",{ controller: "loginController",templateUrl: "/HTML/login.html" }); $routeProvider.when("/signup",{ controller: "signupController",templateUrl: "/app/views/signup.html" }); $routeProvider.when("/register",templateUrl: "/app/views/register.html" }); $routeProvider.when("/refresh",{ controller: "refreshController",templateUrl: "/app/views/refresh.html" }); $routeProvider.when("/tokens",{ controller: "tokensManagerController",templateUrl: "/app/views/tokens.html" }); $routeProvider.when("/borrower",{ controller: "borrowerController",templateUrl: "/HTML/app/borrower.html" }); $routeProvider.otherwise({ redirectTo: "/home" }); });
<!DOCTYPE html> <html ng-app="app"> <head> </head> <body ng-controller="BorrowerQuickQuoteApplication"> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="/assets/js/jquery.min.js"></script> <script src="/assets/js/modernizr.js"></script> <!-- Include all compiled plugins (below),or include individual files as needed --> <script src="/assets/js/bootstrap.min.js"></script> <script src="/Scripts/angular.js"></script> <script src="/Scripts/angular-cookies.min.js"></script> <script src="/Scripts/angular-resource.min.js"></script> <script src="/Scripts/angular-sanitize.min.js"></script> <script src="/Scripts/angular-route.min.js"></script> <script src="/Scripts/angular-ui-router.min.js"></script> <script src="/Angular/controllers.js"></script> <script src="/Angular/LoanApplicationController.js"></script> <script src="/Angular/services.js"></script> <script src="/Scripts/angular-local-storage.min.js"></script> <script src="/Scripts/loading-bar.min.js"></script> <script src="/Angular/app.js"></script> </body> </html>
知道我需要做些什么来使这个工作吗?
我应该修改RouteConfig.cs文件还是我还需要做其他事情?
谢谢,Laziale