2016-05-12 12 views
0

私は2つのラジオボタンを持っています1.従業員2の顧客私は従業員IDを選択する必要があります。私が最初のtymのためにそれをクリックしているとき、うまく動作していない2度目は動作しません。私はラジオボタンイベントが2回目に起動しない

<div ng-show="ge == true"> 
     <div class="row control-group" ng-show="addUser.geEmp" ng-class="{error:addUserForm.phone.$dirty && !addUserForm.phone.$valid && !addUserForm.phone.$error.pattern, success:addUserForm.phone.$valid}"> 
       <label class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">{{::'label.addUser.SSO'|translate}}</label> 

       <div class="col-xs-7 col-sm-7 col-md-9 col-lg-9 controls"> 
        <input type="text" 

         class="input-xlarge" 
         id="sso" 
         name="phone" 
         ng-model="addUser.user.phone" 
         ng-pattern="ph_numbr" 
         placeholder="{{::'placeholder.addUser.phone'|translate}}" 
         ng-change="addUserForm.phone.$setValidity('duplicateName', true);" 
         required="true" 
         ng-maxlength=8 
         ng-minlength=8 
         ge-auto-focus 
         /> 

        <span class="help-block" ng-show="addUserForm.phone.$dirty && addUserForm.phone.$error.required">{{::'error.required'|translate}}</span> 
        <span class="help-block" ng-show="addUserForm.phone.$dirty && addUserForm.phone.$error.pattern">{{::'error.number'|translate}}</span> 
        <span class="help-block" ng-show="addUserForm.phone.$dirty && addUserForm.phone.$error.maxlength">{{::'error.max.length'|translate}}</span> 
        <span class="help-block" ng-show="addUserForm.phone.$dirty && addUserForm.phone.$error.duplicateName">{{::'error.editOrganization.duplicateName'|translate}}</span> 
       </div> 
      </div> 

JSファイル

$scope.ge = function() { 

     $scope.ge = true; 
    } 

    $scope.customer = function() { 
     $scope.ge = false; 
    } 

答えて

0

あなたが定義した変数だけでなく、geとしての機能を表示したい

HTMLファイル

<div class="row control-group"> 
      <label > 
        <input name="cssPre" id="css1" value="geEmp" class="input-xlarge" type="radio" data-ng-model="addUser.Emp" ng-change="ge()">{{::'label.addUser.employee'|translate}} 
      </label> 

     <label > 
     <input name="cssPre" id="css2" value="customer" type="radio" data-ng-model="addUser.customer" ng-change="customer()">{{::'label.addUser.Customer'|translate}} 
     </label> 

テキストボックスには、のいずれかをの名前を変更しますこれらの。

あなたはあなたのコードごとに

$scope.ge = function() { 
    $scope.ge = true; 
} 

$scope.ge変数を洗練されているので、

$scope.someProperFunctionName = function() { 
    $scope.ge = true; 
} 

HTML

<input name="cssPre" id="css1" value="geEmp" class="input-xlarge" type="radio" data-ng-model="addUser.Emp" ng-change="someProperFunctionName()"> 
に変更
関連する問題