I'm working on a simple upper/lower case directive. Since I use ControlValueAccessor I would like to be able to require ngModel directive on a same host element where I apply my appCaseTo directive.
Is there way to do that in Angular?
How to require presence of certain directive from another directive?
Similar to AngularJS with require: 'ngModel'
approach.
return {
require: 'ngModel',
link: function (scope, element, attrs, modelCtrl) {
Stackblitz project.
我不确定您要完成什么,但是您可以将ngModel“包括”到选择器中,如下所示:
selector: '[ngModel][appCaseTo]',
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.