Angularjs:如何在注释块关闭NG-如果? [英] Angularjs: how to close ng-if in comment block?
问题描述
< DIV NG-IF =真正的>可见< / DIV>
是pretty容易,但由于的 ngIf 甚至可以在评论中使用,这将是结束< / DIV>
的注释块?
<div ng-if="true">visible</div>
is pretty easy, but since ngIf can be used even in comments, what would be the closing </div>
for comment block?
试过了,W / O运气:
Tried, w/o luck:
<!-- ng-if: true -->
....
<!-- ng-if -->
感谢。
推荐答案
NG-如果
仅限于'A'
。所以它只能用来作定语,你不能在评论使用这里的angularjs code为ngIf
ng-if
is restricted to 'A'
. so it can be used only as attribute, you can't use in comment Here's the angularjs code for ngIf
var ngIfDirective = ['$animate', function($animate) {
return {
transclude: 'element',
priority: 600,
terminal: true,
restrict: 'A', // --> This means restricting to Attribute
的限制
选项通常设置为:'E'
,'A'
,'C'
,M
The restrict
option is typically set to: 'E'
,'A'
,'C'
,'M'
一 EACM的
限制指令到特定的指令,声明风格。 如果你没有任何限制,(元素和属性)将使用默认值
。
One of EACM
restricts the directive to a specific directive declaration style. If you don't restrict any, the defaults (elements and attributes) are used
.
电子
- 元素名称(默认):&LT;我的指导性和GT;&LT; /我-指令&GT;
E
- Element name (default): <my-directive></my-directive>
A
- 属性(默认):&LT; DIV我-指令=EXP&GT;&LT; / DIV&GT;
A
- Attribute (default): <div my-directive="exp"></div>
C
- 等级:&LT; DIV CLASS =我-指令:EXP;&GT;&LT; / DIV&GT;
M
- 评论:&LT; - 指令:!我-指令EXP - &GT;
这篇关于Angularjs:如何在注释块关闭NG-如果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!