gpt4 book ai didi

html - 为什么 ng-hide 和 ng-show 不起作用?

转载 作者:行者123 更新时间:2023-11-27 23:27:05 24 4
gpt4 key购买 nike

美好的一天。我使用了几种方法来使用 ng-show 和 ng-hide 但它们都不起作用。单击按钮时,第一个 div 应该隐藏,第二个出现。请帮帮我!这是我最后尝试的方式:

<div class="parentDiv .col-lg-">
<from class="centerMain">
<div ng-show="showF" class="center-block"> <!-- this div should hides -->
<div>
<label class="center-block">Введите PIN</label>
</div>
<div>
<input name="userName" placeholder="1234" class="center-block inputLine">
</div>
<div>
<button ng-click="showF = !showF" class="center-block buttonBig">Установить PIN</button> <!-- this button makes hiding -->
</div>
</div>
<div ng-show="!showF" class="center-block"> <!--this should appears -->
<div>
<label class="center-block">Подтвердите пин</label>
</div>
<div>
<input name="userName" placeholder="1234" class="center-block inputLine">
</div>
<div>
<button class="center-block buttonBig">Подтвердить</button>
</div>
</div>
</from>
</div>

最佳答案

Angular 2 弃用了许多不必要的 Angular 1 指令。

你可以使用 [hidden]/[ngIf][hidden]="showF" 或者 *ngIf="showF”

所有基于事件的指令都已弃用,您可以通过将事件名称包装在 (eventName)

中直接调用 DOM 上的事件
(click)="myFunction()" //instead of ng-click
(focus)="myFunction()" //instead of ng-focus

关于html - 为什么 ng-hide 和 ng-show 不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37862527/

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