【问题标题】:$event.stopPropagation(); not working on firefox$event.stopPropagation();不能在火狐上工作
【发布时间】:2017-09-13 02:37:06
【问题描述】:
    <li ng-repeat="chat in openedChats track by $index" ng-click="init($index,'maximize')" role="button">
        <button class="minimized-chat-box" >
        <label style="float:left;color:white"><strong>{{chat.NAME}}</strong></label>
        <i class="fa fa-remove" style="color:white;float:right;font-size:14px;" role="button" ng-click="init($index,'close');$event.stopPropagation();">
        </i>
        <i class="fa fa-window-maximize" style="color:white;float:right;font-size:14px" role="button" ng-click="init($index,'maximize');$event.stopPropagation();">
        </i>
        </button>
    </li>

这是我用于使按钮内的图标可点击的代码,它在 chrome 上运行良好,它停止在 firefox 上运行,有没有办法可以修改它以在两者上运行。我真的找不到一种方法让它对两者都适用!

提前致谢。我是 angularjs 的新手,我很想使用 angular 来做到这一点。

【问题讨论】:

    标签: angularjs button cross-browser event-propagation


    【解决方案1】:

    试试这个

    $scope.init = function($event,$index,'maximize'){
    $event.stopPropagation();
    };
    

    然后像这样调用它

    ng-click="init($event,$index,'close')
    

    【讨论】:

    • $event.preventDefault() 怎么样?
    • 它们似乎都不能在 Firefox 上运行,但它在 chrome 上运行良好
    猜你喜欢
    • 2016-01-05
    • 2023-03-22
    • 1970-01-01
    • 2017-10-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-23
    相关资源
    最近更新 更多