【发布时间】:2016-09-13 06:44:34
【问题描述】:
我想在视图加载后/进入该视图后执行一个函数。
我的目录如下:
app.directive('bonFormViewerFrame', function ($formStore) {
return {
restrict: 'E', //bind to element tag name
replace: true, //replace the entire markup with the template
templateUrl: 'ui/controls/bon-form-viewer-frame.html',
scope: {
form: '=' //specifies the item to be displayed.
},
controller: ['$scope', function ($scope) {
$scope.formContent = ($scope.form != null) ? $scope.form.Content : "";
$scope.$on("$ionicView.beforeEnter", function (event, data) {
// handle event
console.log("State Params: ", data.stateParams);
});
$scope.$on("$ionicView.enter", function (event, data) {
// handle event
console.log("State Params: ", data.stateParams);
});
$scope.$on("$ionicView.afterEnter", function (event, data) {
// handle event
console.log("State Params: ", data.stateParams);
});
}]
};
});
以上$ionicView 事件均未触发。谁能帮我吗?或者我在这里做错了什么?
【问题讨论】:
-
此事件不会发送到指令。您将需要从页面的控制器发送它或考虑其他机制可能与服务链接事件和指令
标签: angularjs ionic-framework ionic-view