需要在 angular 应用程序内将小胡子样式文字打印到屏幕(“{{}}”)
Need to print mustache style literals to screen ("{{}}") inside angular app
在我的 AngularJS 应用程序中,我需要向用户展示他们可以在文本框内使用 Liquid Markup。
不幸的是,LiquidMarkup 使用 {{ the_same_syntax_as_angular }}
并且我的解释文本被评估为 Angular 代码。
- 我不想更改流动标记的默认分隔符。
- 转义字符 (
\
) 不会阻止 angular 计算表达式。
- 示例文本位于
<input>
标签的 placeholder
属性中。 它不在 DOM 节点内。
如何转义 Angular 的双胡子语法来打印示例?
<div ng-non-bindable>Ignored: {{ your Mustache example }}</div>
工作示例:
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<body ng-app="">
<div>Normal: {{1 + 2}}</div>
<div ng-non-bindable>Ignored: {{1 + 2}}</div>
<div>Ignored inside the placeholder: <input ng-non-bindable placeholder="{{1 + 2}}"/></div>
</body>
在我的 AngularJS 应用程序中,我需要向用户展示他们可以在文本框内使用 Liquid Markup。
不幸的是,LiquidMarkup 使用 {{ the_same_syntax_as_angular }}
并且我的解释文本被评估为 Angular 代码。
- 我不想更改流动标记的默认分隔符。
- 转义字符 (
\
) 不会阻止 angular 计算表达式。 - 示例文本位于
<input>
标签的placeholder
属性中。 它不在 DOM 节点内。
如何转义 Angular 的双胡子语法来打印示例?
<div ng-non-bindable>Ignored: {{ your Mustache example }}</div>
工作示例:
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<body ng-app="">
<div>Normal: {{1 + 2}}</div>
<div ng-non-bindable>Ignored: {{1 + 2}}</div>
<div>Ignored inside the placeholder: <input ng-non-bindable placeholder="{{1 + 2}}"/></div>
</body>