jquery - How to target dynamic generated id {{element}} inside angular Directive -
i have requirement have created directive below:
app.directive('popover', function ($compile) { return { restrict: "a", link: function (scope, element, attrs) { // template var templateid = element.data('popover-template'); var templatehtml = $('#' + templateid).html(); // compile content , class var popover_content = $compile(templatehtml)(scope); var popover_class = element.data('popover-class');
and in html page have passed id angular expression below
data-popover-template="{{field.popoverid}}"
after running code getting error error: syntax error, unrecognized expression: {{field.popoverid}}
.
could me issue?
the error self-explanatory: data-popover-template
expects expression. try this:
data-popover-template="field.popoverid"
expression interpolation result {{}}
not expression anymore, directive can't set data binding in case.
Comments
Post a Comment