离子框架离子标签不发射事件 [英] Ionic framework ion tabs not firing event

查看:98
本文介绍了离子框架离子标签不发射事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目有一个导航视图,当单击特定选项卡并弹出一个操作表时,我想要底部的选项卡。我尝试在实例化控制器时启动一个函数但是只启动一次操作表明显

My project has a navigation view with tabs at the bottom I want when a specific tab is clicked an action sheet pops up. I tried launching a function when the controller is instantiated but that only launches the action sheet once obviously

推荐答案

我做了一些事情做这项工作 - 不确定它是最好的。首先,我从标签和内部导航子项中删除了href:

I did a few things to make this work - not sure it is the best. First, I removed the href from a tab and the inner nav child:



我还添加了一个ng-click动作。我的showActionSheet需要在rootScope中定义,而不是控制器,因为无论哪个控制器处于活动状态,它都需要可用。所以在app.js中,我为它添加了示例代码。

I also added a ng-click action. My showActionSheet needs to defined in rootScope, not a controller, since it needs to be available no matter what controller is active. So in app.js, I added the sample code for it.

.run(function($ionicPlatform,$rootScope,$ionicActionSheet) {

$rootScope.showActionSheet = function() {
  console.log("showAS");
  var hideSheet = $ionicActionSheet.show({
    buttons: [
      { text: '<b>Share</b> This' },
      { text: 'Move' }
    ],
    destructiveText: 'Delete',
    titleText: 'Modify your album',
    cancelText: 'Cancel',
    cancel: function() {
    // add cancel code..
    },
    buttonClicked: function(index) {
      return true;
    }
});


};

这篇关于离子框架离子标签不发射事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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