简体   繁体   中英

Angular UI-router not displayig the view

I try to make a nested views with UI-Router, but got stuck with fact that my view not displaying, though XHR in console indicates correct path and success in loading.The URL also updated as expected.

Here's the related code:

         .state('teams.tasks', {
             url: '/:teamID',
             templateUrl: 'views/items.html',
             controller: "itemsCtrl"
         })

         .state('items', {
             url: '/items',
             templateUrl: 'views/items.html',
             controller: "itemsCtrl"
         })

and in the view:

    <a ui-sref=".teams({ id: team.id })" class="h4 media-heading">{{ team.name }}</a>

The idea is — when i click this link i go to /teams/teamname, where teamname is created dynamically in the controller. The link url generates properly, but i don't see the related partial.

I think that you forgot ui-view

For example :

<div ui-view ></div>

You need to add the ui-view in your target container

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM