Angular JS observe on directive attribute
How can angular js watch attributes on custom directive in order to accept
angular values to be bind
Here is what I have so far:
app.directive('tile', [function(){ return { restrict: 'E', link:
function(scope, element, attrs) { var title = attrs.title;
attrs.$observe('dataValue', function(val) {
var data = val;
console.log(data);
var dom =
"<div>" +
"<p>" + title + "</p>" +
"<p>" + data + "</p>" +
"</div";
$(element).append($(dom.trim()));
});
}
};
}]);
but the observed value is coming back as undefined
No comments:
Post a Comment