Star rating can be done either statically (read-only) or dynamically

If you want to just show the rating as a star, try using below
Static Star Rating
Working example
HTML
<body ng-app="starApp"> <div ng-controller="StarCtrl"> <span ng-repeat="rating in ratings">{{rating.current}} out of {{rating.max}} <div star-rating rating-value="rating.current" max="rating.max" ></div> </span> </div> </body>
script
var starApp = angular.module('starApp', []); starApp.controller('StarCtrl', ['$scope', function ($scope) { $scope.ratings = [{ current: 5, max: 10 }, { current: 3, max: 5 }]; }]); starApp.directive('starRating', function () { return { restrict: 'A', template: '<ul class="rating">' + '<li ng-repeat="star in stars" ng-class="star">' + '\u2605' + '</li>' + '</ul>', scope: { ratingValue: '=', max: '=' }, link: function (scope, elem, attrs) { scope.stars = []; for (var i = 0; i < scope.max; i++) { scope.stars.push({ filled: i < scope.ratingValue }); } } } });
If you want Star Rating to dynamically try this,
Dynamic star rating
Working demo
Html
<body ng-app="starApp"> <div ng-controller="StarCtrl"> <span ng-repeat="rating in ratings">{{rating.current}} out of {{rating.max}} <div star-rating rating-value="rating.current" max="rating.max" on-rating-selected="getSelectedRating(rating)"></div> </span> </div> </body>
script
var starApp = angular.module('starApp', []); starApp.controller('StarCtrl', ['$scope', function ($scope) { $scope.rating = 0; $scope.ratings = [{ current: 5, max: 10 }, { current: 3, max: 5 }]; $scope.getSelectedRating = function (rating) { console.log(rating); } }]); starApp.directive('starRating', function () { return { restrict: 'A', template: '<ul class="rating">' + '<li ng-repeat="star in stars" ng-class="star" ng-click="toggle($index)">' + '\u2605' + '</li>' + '</ul>', scope: { ratingValue: '=', max: '=', onRatingSelected: '&' }, link: function (scope, elem, attrs) { var updateStars = function () { scope.stars = []; for (var i = 0; i < scope.max; i++) { scope.stars.push({ filled: i < scope.ratingValue }); } }; scope.toggle = function (index) { scope.ratingValue = index + 1; scope.onRatingSelected({ rating: index + 1 }); }; scope.$watch('ratingValue', function (oldVal, newVal) { if (newVal) { updateStars(); } }); } } });
There is a wonderful tutorial here to learn more about Angular Star Rating.