我正在构建一个新的angularJS应用程序,基于AngularJS SPA Visual studio模板(http://visualstudiogallery.msdn.microsoft.com/5af151b2-9ed2-4809-bfe8-27566bfe7d83)
这使用ui-router(https://github.com/angular-ui/ui-router)进行路由.
但是,它似乎区分大小写.
知道如何指示angular/ui-router忽略url参数的情况吗?
在应用程序中区分大小写无关紧要,但是如果用户键入一个URL以在特定页面上输入应用程序,我们需要确保它about也是相同的aBouT
干杯
我很难理解为什么我的基础href似乎区分大小写.我有一个带有基本href的页面,并使用angularjs路由.
HTML:
<html ng-app="app">
<head>
<base href="/Foo/"/>
</head>
<body>
<div>Foo</div>
<div ng-view></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
JS:
var module = angular.module('app', []);
module.config(function ($routeProvider, $locationProvider) {
$routeProvider
.when('/Home/Page1', { templateUrl = 'partials/page1' })
.otherwise({ redirectTo: '' });
$locationProvider.html5Mode(true);
$locationProvider.hashPrefix('!');
});
Run Code Online (Sandbox Code Playgroud)
如果我导航到http://www.example.com/Foo/,那很好.但是当我导航到http://www.example.com/foo/时,我收到一个角度误差:
Error: Invalid url "http://www.example.com/foo/", missing path prefix "/Foo" !
at Error (<anonymous>)
at Object.LocationUrl.$$parse (http://www.example.com/foo/Scripts/angular.js:4983:13)
at Object.LocationUrl (http://www.example.com/foo/Scripts/angular.js:5014:8)
at $LocationProvider.$get (http://www.example.com/foo/Scripts/angular.js:5387:21)
at Object.invoke (http://www.example.com/foo/Scripts/angular.js:2809:28)
at http://www.example.com/foo/Scripts/angular.js:2647:37
at getService (http://www.example.com/foo/Scripts/angular.js:2769:39)
at Object.invoke (http://www.example.com/foo/Scripts/angular.js:2787:13)
at $CompileProvider.directive (http://www.example.com/foo/Scripts/angular.js:3613:43)
at Array.forEach …Run Code Online (Sandbox Code Playgroud)