从 Angular Ui-Router 中的参数定义 'parent' 值
Define 'parent' value from param in Angular Ui-Router
嗯,我有这种情况:
$stateProvider
.state("main", { abtract: true, url:"/main",
views: {
"viewA": {
templateUrl:"main.html"
}
}
})
.state("other", {
parent: ':foo', // Want here the foo param too (:
//url: '/:foo', // Here it takes de foo param
views: {
"viewB@main": {
templateUrl:"hello.html"
}
},
controller: function($stateParams, $scope, $state) {
var foo = $stateParams.foo;
}
})
我这样称呼它:
<button ui-sref="other({foo: 'main'})">Hello World</button>
可以在 'parent'
属性 中包含 'foo'
参数,就像 'url'
参数一样?
It is possible to have the 'foo' param in the 'parent' property like it was it the 'url' param?
不,不可能。
状态定义在使用前必须完全注册。 (即使是用deferIntercept(defer)懒加载)
url 参数的计算来得太晚了...
嗯,我有这种情况:
$stateProvider
.state("main", { abtract: true, url:"/main",
views: {
"viewA": {
templateUrl:"main.html"
}
}
})
.state("other", {
parent: ':foo', // Want here the foo param too (:
//url: '/:foo', // Here it takes de foo param
views: {
"viewB@main": {
templateUrl:"hello.html"
}
},
controller: function($stateParams, $scope, $state) {
var foo = $stateParams.foo;
}
})
我这样称呼它:
<button ui-sref="other({foo: 'main'})">Hello World</button>
可以在 'parent'
属性 中包含 'foo'
参数,就像 'url'
参数一样?
It is possible to have the 'foo' param in the 'parent' property like it was it the 'url' param?
不,不可能。
状态定义在使用前必须完全注册。 (即使是用deferIntercept(defer)懒加载)
url 参数的计算来得太晚了...