Closed DvirH closed 7 years ago
Hi!
Yes, it is possible, since the scope of your controller is a not-isolated child-scope of the linking function`s scope (see newScope = scope.$new(false, scope)
in function onTooltipTemplateControllerChange(newValue)
.
Here is what I did:
tooltip-id="myTooltipID"
to html element I want to know ID ofgetAttributesToAdd(element)
by adding:
if (element.attr('tooltip-id') !== undefined){ attributesToAdd['tooltip-id'] = element.attr('tooltip-id'); element.removeAttr('tooltip-id'); }
now myTooltipID
will be stored in $attrs
.$attrs
, the variable containing myTooltipID has to be exposed to $scope
. Therefore I added following line to linkingFunction(...)
:
$scope.tooltipID = $attrs.tooltipId;
$scope.$parent.tooltipID;
thanks @steczol for the example.
@steczol Thanks!
I want to load dynamic data according to an element Id. For that I have to pass the element Id to the template controller, but I can't find a way to do so. Any Ideas?