UI路由器的全局状态与"主视图"主视图、路由器、全局、状态

2023-09-13 03:41:25 作者:平凡グ之路

可有人请点我管理全球各国UI路由器的例子吗?我试图实现一个包含所有页面的页眉和页脚一般的网站模板,具有与该视图中的嵌套视图改变沿主视图。

can someone please point me to an example of managing global states for ui-router? i'm trying to implement a general site template that contains on all pages a header and a footer, with a main view that changes along with nested views within that view.

<格UI视图=头> 应该出现在所有页面上,有其自己的控制器。<格UI的视图>主视图持有不同的页面和嵌套的意见<格UI视图=页脚方式> 应该出现在所有页面上,有它自己的控制器

<div ui-view="header"> should appear on all pages, has its own controller. <div ui-view>main view that holds the different "pages" and nested views <div ui-view="footer"> should appear on all pages, has its own controller.

我会尽量详细,这是我与angulars路由当前状态:

i will try to elaborate, this is my current state with angulars routing:

<body>
  <div class="wrap">
      <div ng-include="'partials/header.html'"></div>
      <div ng-view></div>
      <div ng-include="'partials/footer.html'"></div>
  </div> 
</body>

我想迁移到用户界面的路由器,但是不能达到相同的。我需要的头和所有页面页脚和用户界面视图为主要内容,将持有的所有视图/嵌套的支配权和统计信息

i would like to migrate to ui-router, but cannot achieve the same. i need the header and the footer on all pages and an ui-view as main content that will hold all views/nested vies and stats

感谢

推荐答案

这肯定会为你工作。你只需要确保它的用户界面视图 insteadl 的NG-视图。下面是我现在正在使用一个类似的应用程序是什么:

That will definitely work for you. You'll just need to make sure it's ui-view insteadl of ng-view. Here's what I'm using now on a similar app:

<div ng-include src="'app/templates/nav.html'" id="global-nav"></div>
<div ui-view></div>
<footer ng-include src="'app/templates/footer.html'"></footer>