A svbtle-style kudos implementation with AngularJS and Firebase
- 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.
<div og-kudos>
</div>
This alone would work but it needs a little extra configuration (see attributes) for persistence.
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>
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>
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>
an example controller that has angular-kudos
and firebase
as a dependency can be found here
- @dcurtis for kudos
- https://github.com/masukomi/kudos
- https://github.com/gsklee/ngStorage
MIT