简体   繁体   中英

'Require' in Angular Directives with '^^'

There is the following code:

ff.directive('radarMapMap', {
  restrict: 'A',
  require: '^^radarMap',
  link: function (scope, element, attrs, mapCtrl) {
    mapCtrl.setMapElement(element);
  }
});

I don't understand what is the difference between require: '^radarMap' and require: '^^radarMap' . I didn't find it in documentation. Please, make me clear. Thanks in advance!

from the documentation:

^ - Locate the required controller by searching the element and its parents. Throw an error if not found.

^^ - Locate the required controller by searching the element's parents. Throw an error if not found.

Read it here: https://docs.angularjs.org/api/ng/service/$compile

Directive definition options are described in the docs :

^ - Locate the required controller by searching the element and its parents. Throw an error if not found.

^^ - Locate the required controller by searching the element's parents. Throw an error if not found.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM