【问题标题】:Close Keyboard on IOS and Android from Angular 4 typescript从 Angular 4 typescript 关闭 IOS 和 Android 上的键盘
【发布时间】:2017-11-07 12:42:59
【问题描述】:

我正在使用打字稿创建一个 Angular 4 的应用程序。我面临的问题是,当我在底部显示一个 div 时,我想关闭手机中的键盘。

由于 div 位于底部,由于键盘的原因,它不可见。所以我想关闭键盘以便用户可以看到 div。

如何做到这一点?

【问题讨论】:

    标签: android html ios angular typescript


    【解决方案1】:

    你可以试试吗?

    export class yourComponent ...... {
    
    @ViewChildren('yourTextInput') yourTextInput;
    
     ngAfterViewInit() {    
        this.yourTextInput.first.nativeElement.blur();     
    
      }   
    }
    

    【讨论】:

    • 您仍应在答案中包含库链接。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-17
    • 2015-12-19
    相关资源
    最近更新 更多