angular Multiple Named Views记录

Notice that the view names are now specified as absolute names, as opposed to the relative name. It is targeting the ‘filters‘, ‘tabledata‘, and ‘graph‘ views located in the root unnamed template. Since it‘s unnamed, there is nothing following the ‘@‘. The root unnamed template is your index.html.

.state(‘report‘,{
    views: {      ‘[email protected]‘: { },      ‘[email protected]‘: { },      ‘[email protected]‘: { }
    }
  })

@后面没有名字,默认index.html(入口页面)就是模板文件

例子如下:http://plnkr.co/edit/ujgXbPJXQ3E13F9aFPBc?p=preview

例子中

 .state(‘route2‘, {
              url: "/route2",
                  views: {
                    ‘[email protected]‘: {
                    	templateUrl: "route2.html",
                      controller: function($scope){
                        alert("bbbb");
                      }
                    },
                    ‘[email protected]‘: {
                    	templateUrl: "route2.html",
                      controller: function($scope){
                      alert("aaa");
                      }
                    }
                  }
          })

[email protected]和[email protected]的@后面都没有名字,所以默认模板在入口index.html中找对应的ui-view

时间: 2024-12-06 04:17:09

angular Multiple Named Views记录的相关文章

[译]Angular-ui 之 多命名视图(Multiple Named Views)

?上一篇 (Nested States & Nested Views)     下一篇 (URL Routing) ? You can name your views so that you can have more than one ui-view per template. Let's say you had an application state that needed to dynamically populate a graph, some table data and filte

angular报错日常记录

c1—— 遍历json的key...value的时候报错: [tslint] for (... in ...) statements must be filtered with an if statement 原代码: for (let key in this.targetList[0]) { this.tableHeaders.push({ value: key, name: key }) } 修改为: for (const key of Object.keys(this.targetList

Angular 后台报错记录

异常信息:ERROR TypeError: Cannot read property 'xxxx' of undefined 异常原因:"xxx"属性未定义,引发异常的原因可能是HTML模板加载时,这个属性还是未定义状态. 解决方法:可以给这个标签加一个*ngIf指令判断,如果属性未定义就不显示这个标签(这只是一种思路). ================================== 持续更新中~~ 原文地址:https://www.cnblogs.com/dominic-ch

angular UI-Router示例一

一.选择angular-ui-router的好处 ui-router是一个社区库用来完善ng-route的诸多不足 UI-Router路由器允许嵌套视图(nested views)和多个命名视图(multiple named views),我们可能有较多的页面需要继承其他部分,所以很有用. 通过构建ui-sref来实现不同的状态链接到不同的页面 states允许你通过$statsParams来轻松的传递信息,允许不同的信息不同的states的map格式. 你的路由可以访问动态创建的链接 二.简单

ngRoute (angular-route.js) 和 ui-router (angular-ui-router.js) 模块有什么不同呢?

很多文章中都有说道:当时ngRoute在路由配置时用$routeProvider,但是当ui-router路由配置时用 $stateProvider 和 $urlRouterProvider. 那么它们有什么不同呢? 1.ngroute是用AngularJS框架的核心部分. 2.ui-router是一个社区库,它是用来提高完善ngroute路由功能的. 那么我到底用哪个,或者说,哪个更适合可管理性和适合可扩展性? ui-router路由器是一个第三方模块,功能非常强大.它支持一切正常ngrout

ui-router---$stateProvider

转自:http://blog.csdn.net/violet_day/article/details/17515157 $stateProvider $stateProvider.state(stateName, stateConfig) Creates a new application state. For alternate usage, see Object-based States The parameters for .state() are: stateName String 一个

[译]Angular-ui 之 Url Routing

? 前一篇 (Multiple Named Views)     下一篇 (The Components) ? 在你的应用中多数的状态都是基于特定的url地址的.Url Routing机制绝不是在状态机制之上后加的东西,而是一开始就是规划在最初设计方案(译注:angular-ui的设计方案)之中的(在实现url路由的同时独立的保持状态).下面代码展示了你如何设置一个url: Most states in your application will probably have a url asso

AngularUI Router 概要【转】

通过AngularJS来创建SPA(single page application),要想让页面导航看起来跟一般Web页面一样的话,路由相当重要.AngularUI Router是AngularUI 团队开发的一个AngularJS路由模块,相比AngularJS的标准路由ngRoute,它更灵活,基于state而不是URL在一个页面中加载多个View并保持View的层次,Nested States & Views以及Multiple & Named Views.UI-Router被认为是

angular安装记录

1. 安装node.js,下载地址:https://nodejs.org/en/download/,详细的安装教程参考这里:https://blog.csdn.net/u010255310/article/details/52205132 直接一路next就可以.安装好node后,会自动在path中配置了node的安装路径,如果命令行无法识别node命令,重启就好了.node.js安装验证: node -v 因为NodeJS已经集成了npm,所以npm也一并安装好了.npm安装验证: npm -