我希望我的应用以 www.abc.com/#!/abc 开头,目前当我键入 www.abc.com 时它会重定向到 www.abc.com/#!。以下是我的 index.html
<!-- views/index.html -->
<section data-ng-controller="IndexController">
<h1 mean-token="'home-default'">This is the home view</h1>
</section>
// controllers/index.js
angular.module('mean.system').controller('IndexController', ['$scope', 'Global', function ($scope, Global) {
$scope.global = Global;
}]);
我尝试更改路由 templateurl 来自
$stateProvider
.state('home', {
url: '/',
templateUrl: 'public/system/views/index.html'
})
到
$stateProvider
.state('home', {
url: '/',
templateUrl: 'public/abc/views/abc.html'
})
这从功能的 Angular 解决了我的问题,但我也可以从 system/views/index.html 中重定向到另一个 url 吗?
最佳答案
在你的配置部分添加对$urlRouterProvider
的依赖
$urlRouterProvider.when('/', '/abc');
关于javascript - 如何将根页面重定向到angularjs中的另一个url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23930161/