带有“主视图"的ui路由器全局状态 [英] ui-router global state with "main view"

查看:34
本文介绍了带有“主视图"的ui路由器全局状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以给我指出一个管理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.

< div ui-view ="header"> 应该出现在所有页面上,具有自己的控制器.< div ui-view>主视图,其中包含不同的页面"和嵌套视图< div ui-view ="footer"> 应该出现在所有页面上,并具有自己的控制器.

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

我会尽力阐述一下,这是我目前使用角度路由的状态:

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>

我想迁移到ui-router,但无法达到相同目的.我需要所有页面上的页眉和页脚以及一个ui视图作为主要内容,该视图将包含所有视图/嵌套视图和统计信息

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

谢谢

推荐答案

那绝对适合您.您只需要确保它是 ui-view 而不是 ng-view .这是我现在在类似应用程序上使用的内容:

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>

这篇关于带有“主视图"的ui路由器全局状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆