angularJS 嵌套抽象视图 [英] angularJS nested abstract views

查看:23
本文介绍了angularJS 嵌套抽象视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 StateProvider 库在我的 AngularJS 应用程序中创建嵌套视图.我在根定义了一个抽象视图,现在需要将另一个抽象视图定义为先前创建的抽象视图的第二级子级.

I am using StateProvider library to create nested views in my AngularJS app. I had an abstract view defined at the root and now need to define another abstract view as 2nd level child to the previously created abstract view.

面对这个问题,不确定我是否可以嵌套抽象视图.任何想法.

Facing issues with this, Not sure if I can have nested abstract views or not. Any idea.

非常感谢您的帮助.

谢谢

推荐答案

层次结构中可能有更多抽象嵌套状态.这个示例展示了它的实际效果,这些状态的定义可能是这样的:

There could be more abstract-nested states in hierarchy. This example shows it in action, definition of these states could be like this:

$stateProvider
  .state('main', {
      url: "",
      abstract: true,
      templateUrl: 'tpl.main.html',
  })
  .state('main.middle', {
      url: "",
      abstract: true,
      templateUrl: 'tpl.middle.html',
  })
  .state('main.middle.alpha', {
      url: "/alpha",
      templateUrl: 'tpl.leaf.html',
      controller: function ($scope, $state){
        $scope.state = $state.current;
      },
  })

检查 plunker.正如我们所见,根(主)和它的子(中间)根本不使用 url ......但他们可以......

这篇关于angularJS 嵌套抽象视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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