为什么ng-hide和ng-show不工作?
16lz
2021-01-22
Good day. I used a few ways to use ng-show and ng-hide but neither of them work. First div should hide and seccond appear when click a button. Help me please! This is last way I tried:
美好的一天。我用了一些方法来使用ng-show和ng-hide,但他们都不工作。当单击按钮时,第一个div应该隐藏并显示seccond。请帮助我!这是我最后的尝试:
<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>
1 个解决方案
#1
2
Angular 2 has deprecated many unnecessary Angular 1 directives.
角2已经废弃了许多不必要的角1指令。
You could use [hidden]
/[ngIf]
like [hidden]="showF"
OR *ngIf="showF"
可以使用[hidden]/[ngIf] like [hidden]="showF"或*ngIf="showF"
Also all the event based directive are deprecated and you can directly call a event on DOM by wrapping its name in (eventName)
同时,所有基于事件的指令都被弃用了,您可以通过将事件名称包装在(eventName)中来直接调用DOM上的事件
(click)="myFunction()" //instead of ng-click
(focus)="myFunction()" //instead of ng-focus
更多相关文章
- KeyPress或KeyDown事件没有得到html元素的buind
- 通过html5 touch事件封装手势识别组件
- HTML5移动开发技术要点总结及各事件含义
- HTML5晃动DeviceMotionEvent事件
- 用一个听众听多个事件?
- 如何通过mysql查询获得具有不同时区的事件的日,小时,分钟,秒
- 【文档】五、Mysql Binlog事件结构
- 向数据库添加1的PHP Onclick事件(SQL)
- 如何最好地处理重复日历事件的异常