Amazing AngularJS 1 Rating Stars directive that works with Angular Material.
Demo : https://embed.plnkr.co/q7pgHz/
npm install angular-star-ratings
bower install angular-star-ratings
- Add
angular-star-ratings.js
to your index file:
<script src="angular.js"></script>
<script src="angular-star-ratings.js"></script>
- Add
angular-star-ratings.css
to your index file:
<link href="angular-star-ratings.css" rel="stylesheet" type="text/css" />
- Add the google material icons
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
- Add a dependency to the
angular-star-ratings
module in your application.
angular.module('MyApp', ['angular-star-ratings']);
- Add a
angular-star-ratings
tag to your html, set the amount of stars and bind a variable that will holds the selected value. If the maxRating variable is not set, we use the default of 5.
<angular-star-ratings max-rating="8" rating="ctrl.rating" read-only="ctrl.readOnly" on-rating="ctrl.onRating(rating)" >
</angular-star-ratings>
This module is released under the permissive MIT license. Contributions or suggestions are always welcome :D