angular2是否具有ngCloak [英] Does angular2 have ngCloak

查看:106
本文介绍了angular2是否具有ngCloak的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AngularJS 1.x具有ngCloak指令,该指令用于防止Angular html模板以其原始(未编译)形式被浏览器短暂显示.

AngularJS 1.x has ngCloak directive, which is used to prevent the Angular html template from being briefly displayed by the browser in its raw (uncompiled) form.

Angular 2是否具有任何此类指令或功能来防止这种原始(未编译)表单显示.

Does Angular 2 have any such directive or functionality to prevent such raw(uncompiled) form display.

推荐答案

Angular2 desn'具有 ngCloak

Angular2 desn' have ngCloak,

相反,您可以使用?.运算符(与对象一起使用).

instead you can use ?. operator (use it with object).

{{user?.name}}

AND/OR

您可以使用 * ngIf (到目前为止)

you can use *ngIf (as of now)

<div *ngIf="name"> {{name}}</div>

这篇关于angular2是否具有ngCloak的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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