如何使用角度指令作为注释?

时间:2014-05-28 04:43:49

标签: angularjs angularjs-directive

我尝试将ng-repeatng-if用作comment directives neither seems to work (plnkr)

<div><strong>Loop this:</strong></div>

<!-- directive: ng-repeat-start: val in arr -->
  <p ng-if="true">Hello {{val}}!</p>
<!-- directive: ng-repeat-end -->

<strong>Don't show this stuff:</strong>

<!-- directive: ng-if false -->
  <div ng-repeat-start="val in arr">{{val}}</div>
  <div ng-repeat-end>({{val*2}})</div>
<!-- end directive: ng-if -->

(请注意$scope.arr = [1,2,3,4,5];

提供什么?

1 个答案:

答案 0 :(得分:2)

这是因为它们都被声明为仅用作属性: ng-repeatng-if。 查看“使用情况”部分