AngularJS小bug

select下拉选择第一个选项为空白的解决办法
AngularJS H5 video src url
MVC,MVP 和 MVVM 的图示这里写链接内容

ng-selected

<select id="staffSiteId"  ng-model="staffSiteId">
  <option value="{{list.id}}" 
    ng-repeat="list in staffRoleList" 
    ng-selected="list.id==staffSiteId?true:false" >
    {{list.name}}
  </option>
</select>

ng-change 还没有输入完就执行方法 解决方案

<input 
 ng-change="customerRecordSearchFreshCard()"
 ng-model="customerWhereFreshCard">
 问题: 在不到一秒的时间  再次输入,即再次调用  
 customerRecordSearchFreshCard  这个方法

解决方案:应用延时器,把customerRecordSearchFreshCard  
里面要执行的部分放到延时器里面,
当你再次调用的时候,先取消掉你上一次的的延时器
----------
var timer_refresh_card;
 $scope.customerRecordSearchFreshCard = function() { 
    clearTimeout(timer_refresh_card);
    timer_refresh_card = setTimeout(function() {
        if($scope.customerWhereFreshCard == "") {
            return;
        }
        //你的操作
        clearTimeout(timer_refresh_card);
    }, 1000);
};
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值