Angularjs: how to close ng-if in comment block?
问题 <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? Tried, w/o luck: <!-- ng-if: true --> .... <!-- ng-if --> Thanks. 回答1: 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