在表达式中使用额外字符渲染 ng-bind
rendering ng-bind with extra characters in the expression
我正在使用 ng-bind
来避免在呈现页面时看到我的 {{variables}},它运行良好,除了当我添加 ()
的额外字符来包装其中一个变量,当页面仍在呈现时,它们看起来像空的 ()
<span ng-bind="(selected.id) + ' (' + (selected.serialnumber) + ') ' "></span>
任何建议的解决方案或解决方法?
可以使用ng-cloack
.
The ngCloak directive is used to prevent the Angular html template
from being briefly displayed by the browser in its raw (uncompiled)
form while your application is loading.
文档。 here
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-ng-cloak-production</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"></script>
</head>
<body ng-app="">
<u>with ng-cloak: (Expression hidden)</u>
<div ng-cloak>{{ 'Hello world' }}</div>
<div class="ng-cloak">{{ 'Hello world' }}</div>
<u>without ng-cloak: (Expression visible first time)</u>
<div>{{5+3+333+555}}</div>
<div>{{ 'world' }}</div>
</body>
</html>
我正在使用 ng-bind
来避免在呈现页面时看到我的 {{variables}},它运行良好,除了当我添加 ()
的额外字符来包装其中一个变量,当页面仍在呈现时,它们看起来像空的 ()
<span ng-bind="(selected.id) + ' (' + (selected.serialnumber) + ') ' "></span>
任何建议的解决方案或解决方法?
可以使用ng-cloack
.
The ngCloak directive is used to prevent the Angular html template from being briefly displayed by the browser in its raw (uncompiled) form while your application is loading.
文档。 here
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-ng-cloak-production</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"></script>
</head>
<body ng-app="">
<u>with ng-cloak: (Expression hidden)</u>
<div ng-cloak>{{ 'Hello world' }}</div>
<div class="ng-cloak">{{ 'Hello world' }}</div>
<u>without ng-cloak: (Expression visible first time)</u>
<div>{{5+3+333+555}}</div>
<div>{{ 'world' }}</div>
</body>
</html>