jQuery Mobile的角度+:复选框被忽略角 [英] Jquery Mobile + Angular: Checkboxes are ignored by angular

查看:128
本文介绍了jQuery Mobile的角度+:复选框被忽略角的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于以下几点:

Given the following:

<html ng-app>
...
<script>
    function Main($scope){
      $scope.checked = function() {
        alert("This will never show!");
      };
    }
</script>
<body>
<div data-role="page" ng-controller="Main">
    <div data-role="header">
    <h1>Sample</h1>
</div>
<div data-role="content">
    <label for="mybox">Click here!</label>
    <input id="mybox" type="checkbox" ng-model="boxval" ng-change="checked()">
</div>
</div>
</body>
</html>

检查或取消勾选框不会触发方法调用。通过删除&LT;标签&gt; 标记它会正常工作。

我知道jQuery Mobile的是做底层&LT的一些花哨的操作;输入类型=复选框&GT; 标签,但有一个简单的方法将其诱骗至激活NG-变化?

I know JQuery Mobile is doing some fancy manipulation of the underlying <input type="checkbox"> tag, but is there a simple way to trick it to activate the ng-change?

推荐答案

因此​​,原来所有我需要做的就是这个工作是改变我的javascript进口秩序前角导入jQuery的。突然,它是所有奇迹般地工作。

So it turns out all I needed to do to get this to work was change the order of my javascript imports to import jQuery before Angular. Suddenly it is all magically working.

这篇关于jQuery Mobile的角度+:复选框被忽略角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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