带typescript的$stateprovider中父级中的默认子级
我有一个html页面,其中包含:带typescript的$stateprovider中父级中的默认子级,typescript,angular-ui-router,angular-ui,state,Typescript,Angular Ui Router,Angular Ui,State,我有一个html页面,其中包含: <div id="..." class="container"> <pp-nav></pp-nav> <div ui-view></div> </div> 我希望当我转到父页面时,stateprovider打开父html页面,其中包含第一个子页面。 我怎么做 如果我把一个链接放在父亲的按钮里 ui-sref="gestionePeP.puntiAttivazione" 它会
<div id="..." class="container">
<pp-nav></pp-nav>
<div ui-view></div>
</div>
我希望当我转到父页面时,stateprovider打开父html页面,其中包含第一个子页面。
我怎么做
如果我把一个链接放在父亲的按钮里
ui-sref="gestionePeP.puntiAttivazione"
它会打开正确的页面。但我想要的是没有任何点击的相同行为。
我试过$state.go('gestionepe.puntiavazione'),但它是循环的。
我该怎么解决呢?到目前为止,我找到的最好办法是: 只需将这些行添加到some.run()中 并使用默认值扩展state def
重定向到
:
.state('gestionePeP', {
url: '/gestionePeP',
templateUrl: '.../gestionePeP/gestionePeP.html',
// this will set redirect target
redirectTo: 'gestionePeP.puntiAttivazione',
})
检查se工作插销
扩展-如何使ng.ui.IState知道新属性重定向到
只需在代码中添加以下行:
declare module angular.ui { export interface IState { redirectTo?: string; } }
重定向到类型IState中不存在。将其作为
IState
的一部分并不困难,对吗?;)扩展答案应说明如何;)我不知道在哪里添加app.run函数你看到我的plunker了吗?是的,但我没有app.js文件
.state('gestionePeP', {
url: '/gestionePeP',
templateUrl: '.../gestionePeP/gestionePeP.html',
// this will set redirect target
redirectTo: 'gestionePeP.puntiAttivazione',
})
declare module angular.ui { export interface IState { redirectTo?: string; } }