如何使这样一个控制块每次执行的状态下访问? [英] How to make so a controller block is executed everytime a state is accessed?

查看:205
本文介绍了如何使这样一个控制块每次执行的状态下访问?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有连接到状态控制器,每次说的状态访问,我需要我的控制器运行块,我做了验证。

I have a controller attached to a state, and everytime said state is accessed, I need my controller to run a block where I do a verification.

我怎样才能做到这一点?

How can I do this?

推荐答案

有关重装控制器每次你应该提到时间重载:真的你的选择 UI路由器的.STATE 声明

For reloading controller every time you should mention reload: true option on you .state declaration of ui-router

样品code

$stateProvider
.state('state1', {
      templateUrl: 'state1.html',
      controller: `state1Ctrl`,
      reload: true //forcefully reload route and load controller again
})

你也可以参照此<一个href=\"http://stackoverflow.com/questions/21714655/angular-js-angular-ui-router-reloading-current-state-refresh-data\">SO问题

这篇关于如何使这样一个控制块每次执行的状态下访问?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆