2016-12-06 3 views
0

スイッチボタンをsteatmentが、それは外のswitch文はここに私のコードである場合にのみ動作します:NG-スイッチボタンは、switch文の内側

<div ng-controller="LoginController as LC"> 
    <div ng-switch on="view.name"> 

     <div ng-switch-default> 
      <input type="email" required> 
      <input type="password" required> 
      <button type="submit" class="form-submit">Login</button> 
      <a href="#" ng-click="view.name='forgotpassword'">Forgot Your Password</a> 
     </div> 

     <div ng-switch-when="forgotpassword"> 
      <input type="email" equired> 
      <button type="submit" class="form-submit">Send</button> 
     </div> 
    </div> 
</div> 



.controller('LoginController', function ($scope, ModalService) { 
    $scope.view = { 
     name: '' 
    }; 
}); 
+0

あなたのコードが動作しています...「パスワードを忘れました」をクリックすると、パスワード忘れのdivが表示されます – Weedoze

答えて

1

私はちょうど外にdiv要素を追加し、追加ng-hide

<a href="#" ng-hide="view.name === 'forgotpassword'" ng-click="view.name = 'forgotpassword'">Forgot Your Password</a>