angular.module("StarsDirective", []).directive('stars', function () { return { templateUrl: "?component=" + "Directives/Stars" + "&html", restrict: "E", scope: { value: "=", small: "=", big: "=", editable: "=" }, link: function ($scope) { $scope.stars = [0, 1, 2, 3, 4]; $scope.setStar = function (i) { if ($scope.editable) { $scope.value = i + 1; } }; } }; });