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

更多相关文章

  1. KeyPress或KeyDown事件没有得到html元素的buind
  2. 通过html5 touch事件封装手势识别组件
  3. HTML5移动开发技术要点总结及各事件含义
  4. HTML5晃动DeviceMotionEvent事件
  5. 用一个听众听多个事件?
  6. 如何通过mysql查询获得具有不同时区的事件的日,小时,分钟,秒
  7. 【文档】五、Mysql Binlog事件结构
  8. 向数据库添加1的PHP Onclick事件(SQL)
  9. 如何最好地处理重复日历事件的异常

随机推荐

  1. PHP标准库 (SPL)之Countable用法示例
  2. 2021年PHP面试题大全
  3. 30天php学习记录(换行符)
  4. 一小时学会简易在线投票系统(php)
  5. 详解PHP中abstract(抽象)、final(最终)和
  6. PHP的中间件是什么?有什么作用?
  7. PHP预定义接口之Iterator用法示例
  8. PHP之Trait功能与用法实例分析
  9. 基于ob系列函数实现PHP网站页面静态化
  10. centos系统如何为php安装memcached扩展