8000 GitHub - fyelci/ionic-rating: An angularjs directive that take care of visualising a star rating bar
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fyelci/ionic-rating

 
 

Repository files navigation

ionic-rating

An angularjs directive that take care of visualising a star rating bar, build for ionic.

rating

Also able to print half star (display only) :

rating-half

Why?

angular-ui has the same rating directive, but it is build on top of bootstrap. This repo just reuse most of the js code, but build for the ionic framework.

How to use?

Install with bower:

$ bower install ionic-rating

In your index.html

<script src="lib/ionic-rating/ionic-rating.min.js"></script>

In you template:

<rating ng-model="rating.rate" max="rating.max"></rating>

In you controller:

// first inject it into your app
angular.module('youApp', ['ionic.rating'])

.controller('yourCtrl', function($scope) {

  // set the rate and max variables
  $scope.rating = {};
  $scope.rating.rate = 3;
  $scope.rating.max = 5;

});

For strict-di, you can use

.controller('RatingController', [ '$scope', '$attrs', 'ratingConfig', function($scope, $attrs, ratingConfig) ]

If you want to make it read only

added readonly="readOnly" to rating directive, and $scope.readOnly = true; to the controller.

If you want to customize star icons, you can override custom-star-icon class like below

.custom-star-icon {
  font-size: 64px;
  color : red;
}

Note: You may also need to include the style file. But I suggest you just copy it to your project.

Build

$ npm i
$ make all

License

MIT

About

An angularjs directive that take care of visualising a star rating bar

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CoffeeScript 88.6%
  • Makefile 6.4%
  • CSS 5.0%
0