我正在为我的混合 Ionic 应用程序使用 AngularJS。
我的 Controller :
.controller('SubmitCtrl', function($scope) {
console.log("this just work for only refreshing the page!);
});
仅在每次刷新页面时,console.log
工作正常,但是当我切换到其他状态,然后返回提交
状态(不刷新页面),console.log
不起作用。
有什么想法吗?
最佳答案
它是 bcoz Ionic 缓存您的页面。 试试这个
<ion-view cache-view="false" view-title="My Title!">
...
</ion-view>
或者,
$stateProvider.state('myState', {
cache: false,
url : '/myUrl',
templateUrl : 'my-template.html'
})
关于javascript - AngularJS Controller 在第一次刷新页面后不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36502604/