angularjs ui-router父状态

前端之家收集整理的这篇文章主要介绍了angularjs ui-router父状态前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
使用 angularjs和ui-router我可以:

A.)定义我的状态时定义自定义变量(参见下面的“数据”).我目前这样做是成功的,想要确保它正确.

.state('parent',{url:'/parent',templateUrl: 'views/parent.html',abstract: true,data: {stuff: 'stuff'}})

B.)让我的孩子继承可变数据(How?)

.state('parent.child',{url:'/child',templateUrl: 'views/parent.child.html',data: parent.data})

解决方法

您没有将“数据”指定为子状态,已经从父/抽象状态继承.
您可以通过以下方式访

$state.current.data

猜你在找的Angularjs相关文章