Has Angular.dart directive an equivalent to AngularJS's `restrict`

守給你的承諾、 提交于 2019-12-24 00:29:47

问题


In AngularJS there is an attribute for directives (and others) to specify if it can be instantiated by an element name or an attribute - like restrict:EA for element AND attribute.

The file angular.dart / lib / directive / ng_a.dart contains a comment * @restrict E which indicates the directive is for the <A> element.

Is restrict not necessary in Angular.dart?
What is the replacement?


回答1:


Correct, Angular.dart doesn't have restrict, so please disregard the comment in ng_a.dart, it's probably just a copy-paste from JS version. All directives/components/controllers use selector, so you normally need to be very specific. If you need an equivalent of restrict:EA, you could apply two annotations on the class. Ex:

@NgDirective(selector: 'foo')
@NgDirective(selector: '[foo]')
class FooDirective {

}


来源:https://stackoverflow.com/questions/20871350/has-angular-dart-directive-an-equivalent-to-angularjss-restrict

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!