我有多个页面,根据我使用ui-routes管理路由的状态,我想更改这些页面。我想在html中访问$ state.current.name。
<div ng-repeat="que in questions.Cars">
我想如下进行动态更改
<div ng-repeat="que in questions.$state.current.name">
,以便遍历页面明智的问题。
将$state
服务包括在控制器中。比您可以将此服务分配给您的范围内的属性。
代码:
$scope.$state = $state;
然后在模板中获取当前状态:
$state.current.name
要获取模板中的当前状态和参数,请使用$state.includes(stateName [, params])
:
$state.includes('state.name', {id: 1}); // returns true
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句