angular-kudos directive
A svbtle-style kudos implementation with AngularJS and Firebase
Getting Started
- include
angular.js
,ngStorage.js
,angular-kudos.js
andkudos.css
into your HTML - include
angular-kudos
in your application's module dependencies. - Use the
og-kudos
directive.
Example
<div og-kudos>
</div>
This alone would work but it needs a little extra configuration (see attributes) for persistence.
Attributes
og-kudos-id
You can give a kudo a unique id to track if a user already voted on a kudo with the particular id, it could take a string or an {{}} expression
Example:
<div ng-repeat="quote in quotes">
<div og-kudos
og-kudos-id="{{quote.id}}">
</div>
</div>
og-kudos-count
You could return a number of how many kudos were filled in with this attribute, it could take a string or an {{}} expression
Example:
<div ng-repeat="quote in quotes">
<div og-kudos
og-kudos-id="{{quote.id}}"
og-kudos-count="{{quotes.kudos}}">
</div>
</div>
og-kudos-done
You can pass in a function for when a kudos action is complete with this attribute
Example:
<div ng-repeat="quote in quotes">
<div og-kudos
og-kudos-id="{{quote.id}}"
og-kudos-count="{{quotes.kudos}}"
og-kudos-done="addCount(quote.id)">
</div>
</div>
Controller
an example controller that has angular-kudos
and firebase
as a dependency can be found here
Credits
- @dcurtis for kudos
- https://github.com/masukomi/kudos
- https://github.com/gsklee/ngStorage
License
MIT