Answer the question
In order to leave comments, you need to log in
Why is id not caught?
I'm making a directive that displays the id of the svg part when clicked.
(function () {
'use strict';
angular
.module('plunker')
.directive('svgMap', svgMap);
function svgMap() {
var directive = {
link: link,
templateUrl: 'test.svg',
restrict: 'EA',
transclude: true
};
return directive;
function link(scope, element, attrs) {
scope.elementId = element.attr("id");
scope.regClick = function () {
console.log(scope.elementId);
};
}
}
})();
ng-click="regClick()"
In each path there is an id. But you are driving undefined. What have I done wrong? Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question