NG-单击在离子应用程序中不起作用
ng-click not working in ionic application
这是我演示Ionic Application的简单代码。
<body ng-app="starter" ng-controller="catego">
<ion-pane >
<ion-header-bar class="bar bar-positive">
<button class="button icon ion-navicon"></button>
<h1 class="title">Hardware Shop</h1>
<button class="button button-clear icon ion-plus-circled" ng-click="popover.show($event)"></button>
</ion-header-bar>
<div class="bar bar-subheader item-input-inset">
<label class="item-input-wrapper">
<i class="icon ion-search"></i>
<input type="text" placeholder="Search item" ng-model="searchitem"/>
<button class="button button-clear" ng-click="clear()">NOTWORKING</button>
</label>
</div>
<ion-content class="has-subheader" style="padding:5px !important;">
<ion-refresher pulling-text="Refreshing..." on-refresh="dorefresh()"></ion-refresher>
<div class="list" >
<div ng-repeat="element in data | filter : searchitem| orderBy : 'category'">
<div class="item item-divider">{{ element.category }}</div>
<ion-list can-swipe="true">
<ion-item class="" href="#" ng-repeat="innerelement in element.companies | filter : searchitem | orderBy : 'toString()' track by $index">
--- {{innerelement}} <br/>
<ion-option-button class="button-positive icon ion-edit"></ion-option-button>
</ion-item>
</ion-list>
</div>
</div>
</ion-content>
</ion-pane>
</body>
我的副标题中显示"不工作"的按钮不起作用。我已确保控制台中没有错误,并且所有其他方法都可以正常工作。我错过了什么吗?
任何帮助都非常感谢。
您必须
将<button>
移动到<label>
之外,如下代码所示:
<div class="bar bar-subheader item-input-inset">
<label class="item-input-wrapper">
<i class="icon ion-search"></i>
<input type="text" placeholder="Search item" ng-model="searchitem" />
</label>
<button class="button button-clear" ng-click="clear()">NOTWORKING</button>
</div>
我发现这个更好,这在我的应用程序上运行良好,在 iOS 上也很好
$scope.$on('$stateChangeSuccess', function() {
$('*[ng-click]').each(function() {
$(this).attr("ng-click");
$(this).attr("on-touch", $(this).attr("ng-click"));
});
});
相关文章:
- 回发前所需的字段验证程序不起作用
- Angular.js ajax和应用程序不起作用
- Rails4-启动多个点击事件处理程序不起作用
- touchstart处理程序之后的touchmove处理程序不起作用
- 我的angular应用程序不起作用
- 按钮在 Chrome 应用中不起作用
- 油脂猴按钮点击处理程序不起作用
- 插入内容后,Iframe 中的单击处理程序不起作用
- 内联点击处理程序不起作用
- 脸书应用程序不起作用
- 委托的事件处理程序不起作用
- 使用 fdb 调试 Adobe AIR JavaScript 应用程序不起作用
- 主干.js事件处理程序不起作用
- 为什么我的 PeerJS 音频聊天应用程序不起作用
- 单击不同 js 文件中定义的事件处理程序和就绪处理程序 - 不起作用
- 邀请朋友尝试脸书应用程序不起作用
- 如果不在 onLoad 函数中,jQuery 事件处理程序不起作用
- 为什么当服务注入第二个控制器时,AngularJS 1.4.8 应用程序不起作用
- 使用gulp-babel ignore编译nodejs应用程序不起作用
- 使用Knockout.js的简单Flickr应用程序不起作用(JSBin准备的)