search

Home  >  Q&A  >  body text

angular.js - Can views of the same level be loaded separately in angular ui router?

https://github.com/angular-ui/ui-router

angular ui router can define multiple views, like this

<body>
    <p ui-view="viewA"></p>
    <p ui-view="viewB"></p>
    <!-- Also a way to navigate -->
    <a ui-sref="route1">Route 1</a>
    <a ui-sref="route2">Route 2</a>
</body>

I still haven’t found a way to load the viewA and viewB views separately

In other words, when a state changes, only a few of the views at the same level are rendered, and some are not rendered

I just started learning, could you please give me some advice on whether it is possible to render views separately

伊谢尔伦伊谢尔伦2776 days ago590

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-05-15 16:51:39

    What if you only specify the view (viewA/viewB) you want to change in a specific state?

    The old official wiki has examples
    https://github.com/angular-ui/ui-router/wiki/Multiple-Named-Views#example---name-matching

    Added examples of using multiple views
    http://plnkr.co/edit/wy4rqDSsQmHFLmC3Fhm4?p=preview

    reply
    0
  • Cancelreply