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

查看:47
本文介绍了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;
      },
  })

检查朋克车. 我们可以看到,根(主)及其子级(中间)根本不使用url ...但是它们可以使用..

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

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