Edin Puzic
Edin Puzic

Reputation: 1048

ng-switch button inside switch steatment

switch button inside switch statement but It only works when It's outside switch statement Here is my code:

<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: ''
    };
});

Upvotes: 0

Views: 246

Answers (1)

Edin Puzic
Edin Puzic

Reputation: 1048

I just add outside div and add ng-hide

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

Upvotes: 1

Related Questions