AngularJs:两个嵌套的子状态但视图不同

时间:2018-01-05 05:36:22

标签: javascript angularjs

美好的一天,只想问一些我在角度路由中偶然发现的问题。我的目标是制作一个有两个子状态但不同视图的路由。例如:

import maya.cmds as cmds

sel = cmds.ls(sl=True, fl=True)
for i in range(len(sel)):
    pos = cmds.pointPosition(sel[i])
    c = cmds.spaceLocator(n="loc01" , p=(0, 0, 0) )
    d = cmds.xform(c, a=True, t=(pos[0], pos[1], pos[2]) )
    cmds.select(d[0])
    g = cmds.group(d, n = 'loc')
    cmds.select(g[0])
    cmds.createDisplayLayer( noRecurse=True, name='LocLayer' )

这是可行的吗?感谢

2 个答案:

答案 0 :(得分:2)

var parentState = {
    name: "parent",
    url: "/",
    templateUrl: "src/views/parent.html",
    title: "Login Page",
}

var childState = {
    name: "parent.child",
    url: "child",
    views {
       'firstPlace':{templateUrl: "src/views/child1.html"},
       'secondPlace':{templateUrl: "src/views/child2.html"}
    },
    title: "Login Page",
}

$stateProvider
.state(parentState),
.state(childState);

parent.html有

的地方
<div ui-view="firstPlace"></div>
<div ui-view="secondPlace"></div>

答案 1 :(得分:0)

您需要粘贴以下代码:

$stateProvider
                .state('parent.child', {
                    url: '/child',
                    cache: false,
                    views: {
                         'firstPlace':{templateUrl: "src/views/child1.html"},
                         'secondPlace':{templateUrl: "src/views/child2.html"}
                    }
                })
                .state('parent', {
                    url: '/parent-content',
                    templateUrl: 'src/views/parent.html',
                    abstract: true
                })

            $urlRouterProvider.otherwise('/parent-content/')