Sunday, 1 September 2013

How to pass directive parameters to directive

How to pass directive parameters to directive

Need your help. I would like to use my custom directive with parameters
like this:
<p customImage URL_PARAM="some_url.jpg" FIG_PARAM="Fig 1."></p>
My target is to use the directive parameters in the template like this:
.directive('customImage', function() {
return {
replace: true,
template: '<div> <img src="URL_PARAM"> FIG_PARAM </div>'
};
});
How to make this one?

No comments:

Post a Comment