gpt4 book ai didi

javascript - switch 语句内的 ng-switch 按钮

转载 作者:行者123 更新时间:2023-12-03 05:29:45 25 4
gpt4 key购买 nike

switch 按钮位于 switch 语句内,但仅在 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: ''
};
});

最佳答案

我只是添加外部 div 并添加 ng-hide

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

关于javascript - switch 语句内的 ng-switch 按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40996370/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com