0
ui-routerを使用して、アプリケーションのすべてのユーザーがng-repeatで返される 'ユーザー'状態をセットアップしました。ここでUI-Routerネストされた状態ビューはレンダリングされません(レンダリング親ビュー)
.state('users', {
abstract: true,
name: 'users',
url: '/users',
views: {
nav: {
templateUrl: 'templates/navbar.html',
controller: 'MainCtrl'
},
content: {
templateUrl: 'templates/users/index.html',
controller: 'UsersCtrl'
}
}
})
.state('users.show', {
url: '/show/:id',
views: {
nav: {
templateUrl: 'templates/navbar.html',
controller: 'MainCtrl'
},
content: {
templateUrl: 'templates/users/show.html',
controller: 'UsersCtrl'
}
}
});
:私は、子供の状態のビューは、親ビュー「テンプレート/ユーザー/ index.htmlを」(ここで私のapp.jsを継承しているが、ユーザーのプロフィールページを表示状態を作成しようとしています私のindex.htmlです:
<div class="container">
<label>Search: <input ng-model="searchText"></label>
<a ui-sref="users.show({id: user.id})" ng-click="showUser(user.id)" ng-repeat="user in users | filter:searchText ">
<h2> {{ user.name }} </h2>
<h3> {{ user.email }} </h3>
<button ng-click="createConversation({sender_id: current_user.id, recipient_id: user.id})" >Message</button>
</a>
</div>
ブラウザでURLがusers.show状態で継承されているhtmlファイルは両親のユーザー(のindex.html)ファイルですがhttp://localhost:8080/#/users/show/2ある
すべてのヘルプ感謝を。 !
この[ネストされたルート]をお読みください(http://stackoverflow.com/questions/34251255/creating-nested-route-app-in-angular-using-angular-ui-router-and-switching-betwe/ 34251256#34251256) – Maher