Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'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!

like image 756
malcoauri Avatar asked Dec 28 '25 18:12

malcoauri


1 Answers

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

like image 200
Iamisti Avatar answered Dec 31 '25 08:12

Iamisti



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!