【发布时间】:2016-04-07 17:18:52
【问题描述】:
我已经这样配置了$routeProvider
miNgAppplication.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when("/", {
templateUrl: "Base/FirstPage",
controller: "miNgControllerFirstPage"
})
}]);
当我插入带有最后一个斜杠的网址时,这有效,例如“http://localhost/myApp/”。它在 URL 中添加“#/”并显示正确的内容(最终 URL 为“http://localhost/myApp/#/”)
当我不使用斜杠时它不起作用,基本上是因为它错误地更改了 URL
“http://localhost/myApp”->“http://localhost/myApp#/”。
我该怎么办?我是否错误地使用了第一个 when 参数来定义第一页?还是我需要做一些更正?
我已经尝试添加$urlMatcherFactoryProvider.strictMode(true);,但它不起作用(不确定我是否正确,第一行变成miNgAppplication.config(['$routeProvider', '$urlMatcherFactoryProvider', function ($routeProvider, $urlMatcherFactoryProvider) {,对吗?)。
【问题讨论】: