角度5造成严重麻烦的情况,输入框输入缓慢 [英] deep troubling situation with angular 5 and slow typing into input boxes

查看:60
本文介绍了角度5造成严重麻烦的情况,输入框输入缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

存在一个自欺欺人的问题. 我们已经完成了一个Web应用程序,使用的角度为5&模板驱动的表单,一切正常,但这一项功能正在扼杀我们.这就像狙击手.

There is a problem that is posing itself as a show-stopper or deal-breaker. We've completed a web app, using angular 5 & template driven forms where everything works but this one feature is just killing us. It's like a sniper shot.

有时,在笔记本电脑和台式机上,我们会在输入应用程序的输入字段的文本字段时遇到缓慢的输入.这全盘发生(即Windows,mac,safari,chrome).

From time to time, on our laptops and desktops, we experience slow typing into the text fields of our application's input fields. And this happens across the board, ( that is windows, mac, safari, chrome ).

这种情况持续了一段时间,然后完全消失了! 在事件发生期间,没有任何迹象表明我们可以检测到任何东西(症状本身除外).我的意思是没有控制台日志错误,没有高CPU活动,什么都没有!

The situation lasts for a while and then it totally goes away! During the happening, there is no indication of anything we can detect (other than the symptom itself ). I mean there are no console log errors, no high CPU activity, no nothing!.

问题在于,我们只是观察到键入的字母在文本字段和textrea框中的外观出现延迟(最多一秒钟).

The problem is that we simply observe some delay ( up to a second ) in the appearance of the letters we type in, into the textfields and textrea boxes.

您将如何调试这种情况?

How would you debug this situation?

到目前为止,我已经应用了以下解决方案; spellcheck =否, autocapitalize =关闭 自动完成=关闭 自动更正=关闭 但这并没有结束这个传奇.

So far, I have applies the following solutions; spellcheck=no, autocapitalize=off autocomplete=off autocorrect=off But this does not put an end to this saga.

我也使用"ng build --prod"编译应用程序,因此它是完全优化的.

I also compile the app using the "ng build --prod" so it is totally optimized.

您还有其他建议吗?

以下是示例文本区域HTML的格式:

Here is how a sample textarea HTML is:

<textarea placeholder="enter text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"  name="description" [(ngModel)]="learningPlan.description"   maxlength="1500" #local_description="ngModel"></textarea>

是否可以在继续输入时告诉angular不对这些输入框进行更改检测?我没有其他选择了.

Is it possible to tell angular to not to do the change detection on these input boxes while typing is going on? I'm running out of options.

此链接中有一个可能的建议,其中有人建议这样做: @Output() event : EventEmitter<any> = new EventEmitter(false);,但是没有说这行代码应该放在哪里.

There is one possible suggestion in this link whereby someone is suggesting to do this: @Output() event : EventEmitter<any> = new EventEmitter(false); But it does not say where this line of code is supposed to go in.

推荐答案

我发现了此讨论

I've found this discussion ionic issue 10837 and i've solved with content on this link.

就我而言,当我在模式中键入时,此问题显而易见.所以,我的代码变成了这样:

In my case, this problem was visible when i typed inside a modal. So, my code turned into this:

constructor(public changeDetection: ChangeDetectorRef) {}

openModal() {
    this.changeDetection.detach();
    //open modal
    modal.callback ( r => {
        this.changeDetection.reattach();
    });
}

这篇关于角度5造成严重麻烦的情况,输入框输入缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆