Last active
August 29, 2015 14:13
-
-
Save got5/19d7a41a8b81c1200bdf to your computer and use it in GitHub Desktop.
Slide 115 - Using the link function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ng-app="app"> | |
<div class='html-content'><p star-rating data-rate="two">2 comments</p></div></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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