【发布时间】:2017-12-29 14:45:55
【问题描述】:
我在我的 .html 文件中使用这样的方法,但它不起作用。
<p>State is {{state.current.name}}</p>
在 controller.js 中我可以得到它。 但我想在 html 文件中获取它。 任何人都可以在这方面帮助我。
【问题讨论】:
标签: angularjs
我在我的 .html 文件中使用这样的方法,但它不起作用。
<p>State is {{state.current.name}}</p>
在 controller.js 中我可以得到它。 但我想在 html 文件中获取它。 任何人都可以在这方面帮助我。
【问题讨论】:
标签: angularjs
在控制器中将状态分配给变量
$scope.state = $state;
现在您可以在 HTML 中访问它。
<p>State is {{state.current.name}}</p>
确保将$state 注入控制器。
【讨论】: