I have a post ui-view in which I would like to nest another comment ui-view within the same state (app). All views have the same controller as well.
How will I target a ui-view (comment inside the post ui-view) without using a child state. A child state would require a user to navigate to that state to view comments, I would like the posts and comments to visible as soon as a user navigates to the home page.
<!-- index.html -->
<div ui-view="post" ng-repeat="post in posts">
</div>
<!-- posts.html -->
<div class="post">
<p>{{post.body}}</p>
<div ui-view="comment" ng-repeat="comment in post.comments">
</div>
</div>
<!-- comments.html -->
<div class="comment" >
<p>{{comment.body}}</p>
</div>
app.config(['$stateProvider',
function($stateProvider) {
$stateProvider
.state("app", {
url: '/',
views: {
'posts@app': {
templateUrl: 'views/posts.html',
controller: 'PostController',
}
}
})
}
]);