angularjs - 为什么按钮事件在第三次点击后停止?
问题描述
我有这个网站: http: //www.panelatlantik.com/foodx/index.html
例如找到数字 133 并单击。
您将在右侧看到一个新的彩色按钮。单击并等待 2 秒。我会改变的。再次单击等待 2 秒。它会再次改变。伟大的!但是下一次点击不起作用。我做错了什么?
<tr>
<td colspan="2" ng-if="pin3.status=='Yeni'">
<button ng-click="gYap(pin3.orderid)" style="width: 100%" class="btn btn-success">PREPARING</button>
</td>
</tr>
<tr>
<td colspan="2" ng-if="pin3.status=='Gönderildi'">
<button ng-click="iYap(pin3.orderid)" style="width: 100%" class="btn btn-success">SENT</button>
</td>
</tr>
<tr>
<td colspan="2" ng-if="pin3.status=='İptal'">
<button ng-click="gAl(pin3.orderid)" style="width: 100%" class="btn btn-info">CANCELLED</button>
</td>
</tr>
$scope.gYap = function(param){
$http.get("php/makine.php?komut=gYap&id="+param).then(function(response) {
$scope.gYap = response.data;})
$timeout( function(){
$scope.hepsi();
}, 1000 );
$timeout( function(){
$scope.siparisgetir(param);
}, 2000 );
}
$scope.iYap = function(param){
$http.get("php/makine.php?komut=iYap&id="+param).then(function(response) {
$scope.iYap = response.data;})
$timeout( function(){
$scope.hepsi();
}, 1000 );
$timeout( function(){
$scope.siparisgetir(param);
}, 2000 ); }
$scope.gAl = function(param){
$http.get("php/makine.php?komut=gAl&id="+param).then(function(response) {
$scope.gAl = response.data;})
$timeout( function(){
$scope.hepsi();
}, 1000 );
$timeout( function(){
$scope.siparisgetir(param);
}, 2000 );
}
解决方案
第三次点击后我收到了
v2.gYap 不是函数
所以我认为问题就在这里:
$scope.gYap = function(param){ //<-- here gYap is definied as function
$http.get("php/makine.php?komut=gYap&id="+param).then(function(response) {
$scope.gYap = response.data;}) //<-- here gYap is redefinied and its no longer function
$timeout( function(){
$scope.hepsi();
}, 1000 );
推荐阅读
- python - ModelForm 和 ModelSelect2Widget (django-select2)
- javascript - ES6 没有被编译。我正在使用带有 Webpack 的 Babel
- vb.net-2010 - 找不到中间过滤器的组合来建立连接
- android - 从 Fragments 中的 URL 读取数据
- node.js - 云函数因“错误:无法确定 Firebase 数据库 URL”而崩溃。
- javascript - laravel5.8 如何用纯javascript为每个项目打开一个模态窗口
- java - 我该如何解决 - 无法下载 mysql 连接器 .jar... 收到致命警报:protocol_version?
- javascript - 如何等待异步函数导致nodejs
- api-platform.com - 如何使 API-Platform Admin 仅对管理员用户可用?
- c# - 当 RowHeadersVisible = false 时,Datagrid 中的 Visual DataGridBoolColumn 错误