0
私のindex.htmlページをロードしない「」状態は3つのビューがあります。AngularJS UI-ルータ
<header ui-view="header"></header>
<main ui-view="content"></main>
<footer ui-view="footer"></footer>
を私はこれらの3つのビューの代わりに、初期の単一のビューを使用するようにサイトを変更しました。
例えば私のアプリの作業罰金のすべてのルートを、「ホーム」ビュー:
$stateProvider.state('home', {
url: '/home',
data: {
pageTitle: 'Home',
access: 'private',
bodyClass: 'home'
},
views: {
'header': {
templateUrl: 'modules/header/header.html'
},
'content': {
controller: 'HomeController as home',
templateUrl: 'modules/home/templates/home.html'
},
'footer': {
templateUrl: 'modules/footer/footer.html'
}
}
});
私の問題はアプリで「それ以外」の状態であるが、正しくとして「自宅」の状態をロードしません。すべきだ。ページは空白で、コンソールエラーはありません。私のapp.moduleの状態は次のとおりです。
angular.module('app').config(function ($stateProvider) {
$stateProvider.state('otherwise', {
url: '*path',
template: '',
data: {
pageTitle: '',
access: 'public',
bodyClass: ''
},
controller: function ($state) {
$state.go('home');
}
});
});
私はここで何が欠けていますか?
あなたはおそらく '$ urlRouterProvider.otherwise( '/ defaultPath')を設定する必要があります。 '状態定義の後に –
私は' '* path''の前にそのようなことを見たことがありません、それはどういう意味ですか? – Rachmaninoff
他の誰かがそれを作成しましたが、私は考えていません。 – Steve