zoukankan      html  css  js  c++  java
  • 【angular】angular如何让传递变量参数+ng-change的使用

    HTML:
     1 <div class="form-group">
     2     <label class="col-sm-2 control-label">商户名称</label>
     3     <div class="col-sm-4">
     4          <input type="text" class="form-control " id="merchantName" ng-model="merchant.name"
     5                 ng-init="123" value="{{name}}" placeholder="请输入商户名称" 
     6                 ng-class="{'red-border':merchantNameState}" 
     7                 ng-change="tipState(this,'merchantNameState')">
     8      </div>
     9      <div class="col-md-4 red-font" ng-show="merchantNameState">请输入商户名称</div>
    10 </div>
    JS:
    1 $scope.tipState=function (x,stateName) {
    2       if(x.value!==''){
    3            $scope[stateName]=false;
    4       }
    5  };
    • 传递变量参数;

             $scope[stateName]=false

    • ng-change的使用
            必须定义ng-model
     
  • 相关阅读:
    NOI2015刷题记录
    [WC2013][UOJ58]糖果公园 莫队算法
    啦啦啦~
    完全平方数
    构建之法
    测试更新
    程序的测试
    程序的封装
    构建之法5.5-6-7章观后感
    给徐侃童鞋的一个汉堡
  • 原文地址:https://www.cnblogs.com/luanhewei/p/5802967.html
Copyright © 2011-2022 走看看