Skip to content

Instantly share code, notes, and snippets.

@EmmanuelDemey
Created November 24, 2014 13:02
Show Gist options
  • Select an option

  • Save EmmanuelDemey/1662dafec3c751ecb8a1 to your computer and use it in GitHub Desktop.

Select an option

Save EmmanuelDemey/1662dafec3c751ecb8a1 to your computer and use it in GitHub Desktop.
Slide 114 - Using the link function
<div ng-app="app">
<div class='html-content'><p star-rating data-rate="two">2 comments</p></div></div>
angular.module('app',[]).directive('starRating', function () {
return {
link: function (scope, elem, attrs) {console.log("rating");
elem.addClass("rating " + attrs.rate);
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment