你能否告诉我为什么点击事件在点击时显示加载器时不起作用。实际上我创建了一种情况,当我得到数据太晚并尝试从这种情况移动时(尝试移动下一页但存在加载程序)在屏幕上用户无法点击屏幕上的任何按钮。)请点击我的代码笔。当显示加载程序时,用户无法点击按钮.Mean我无法在按钮点击时显示警报 这是我的代码 http://codepen.io/anon/pen/mJXXZY
单击警报时不显示
angular.module('ionicApp', ['ionic'])
.controller('AppCtrl', function($scope, $timeout, $ionicLoading) {
$scope.cll=function(){
alert("---")
}
// Setup the loader
$ionicLoading.show({
content: 'Loading',
animation: 'fade-in',
showBackdrop: false,
maxWidth: 200,
showDelay: 0
});
// Set a timeout to clear loader, however you would actually call the $ionicLoading.hide(); method whenever everything is ready or loaded.
$timeout(function () {
$ionicLoading.hide();
$scope.stooges = [{name: 'Moe'}, {name: 'Larry'}, {name: 'Curly'}];
}, 1000000);
});
答案 0 :(得分:1)
你有一个拼写错误ng-clil而不是ng-click,当你调用一个你需要的函数时();这是你的代码修复:当离子加载器显示时你也无法点击。 工作代码笔:http://codepen.io/anon/pen/zGRWpm
HTML:
<html ng-app="ionicApp">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>Ionic Modal</title>
<link href="http://code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet">
<script src="http://code.ionicframework.com/nightly/js/ionic.bundle.js"></script>
</head>
<body ng-controller="AppCtrl">
<ion-view title="Home">
<ion-header-bar>
<h1 class="title">The Stooges</h1>
</ion-header-bar>
<ion-content has-header="true">
<button ng-click="cll()">click button</button>
<ion-list>
<ion-item ng-repeat="stooge in stooges" href="#">{{stooge.name}}</ion-item>
</ion-list>
</ion-content>
</ion-view>
</body>
</html>