suchen

Heim  >  Fragen und Antworten  >  Hauptteil

angular.js - angular ui router 同一层次视图可以分别加载吗

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

angular ui router 可以定义多个视图,像这样

<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>

始终没有找到这里的viewA和viewB 视图分别加载的办法

或者说在一次状态改变的时候,同层次下的视图,只渲染其中的几个,有几个不渲染

刚开始学习,大家指教一下,分别渲染视图可以做到吗

伊谢尔伦伊谢尔伦2831 Tage vor623

Antworte allen(1)Ich werde antworten

  • ringa_lee

    ringa_lee2017-05-15 16:51:39

    只在特定的狀態指定想要改變的視圖(viewA/viewB)的話?

    官方舊的 wiki 有範例
    https://github.com/angular-ui/ui-router/wiki/Multiple-Named-Views#example---name-matching

    補上使用多視圖的範例
    http://plnkr.co/edit/wy4rqDSsQmHFLmC3Fhm4?p=preview

    Antwort
    0
  • StornierenAntwort