Git Product home page Git Product logo

ionic2-rating's Introduction

ionic2-rating

An Angular2 component to visualize a star rating bar, built for Ionic 2.

Preview

NPM version Downloads

NPM

How to install:

For Angular 2 RC5 and later (Ionic 2 RC.0 and later):
$ npm install --save ionic2-rating
import { Ionic2RatingModule } from 'ionic2-rating';

@NgModule({
  imports: [
    Ionic2RatingModule
  ]
})
export class AppModule {}
For Angular 2 RC4 (Ionic 2 beta version):
$ npm install --save [email protected]

In your component:

import { Ionic2Rating } from 'ionic2-rating';

@Component({
  templateUrl: '...',
  directives: [Ionic2Rating]
})
export class MyComponent {
  private rate = 2.5;
}

How to use:

<rating [(ngModel)]="rate"></rating>

If you want to make it read-only, use "readOnly" property:

<rating [(ngModel)]="rate" readOnly="true"></rating>

If you want to change the number of stars, use "max" property (default is 5):

<rating [(ngModel)]="rate" max="10"></rating>

You may also need to customize component styles:

ul {
  padding: 0px;

  &.rating li {
    padding: 5px 10px;
    background: none;
    color: #ffb400;

    ion-icon {
      font-size: 30px;
    }
  }
}

Based on ionic-rating for Ionic 1: https://github.com/fraserxu/ionic-rating

ionic2-rating's People

Contributors

andrucz avatar patrickbussmann avatar willynilly avatar

Watchers

James Cloos avatar Johnson Chetty avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.