-
-
Notifications
You must be signed in to change notification settings - Fork 86
Installing
You can install angular-star-rating in many ways. The main installing process is described below.
As a precondition i consider you have an assets folder that is included in the bundled version of your app. (which is by default if you use the angular-cli).
- clone & build this repository
- download as .zip
- via npm: by running
$ npm install angular-star-rating --save
from your console - via yarn: by running
$ yarn add angular-star-rating --save
from your console
-
Import your library in your angular application by running:
$ npm install angular-star-rating css-star-rating --save
-
Copy the images from your
./node_modules/angular-star-rating/assets/images
folder into./src/assets/images
folder. -
Import the
star.rating.scss
file i.e. import it in yourstyles.scss
file with@import '~css-star-rating/scss/star-rating';
-
Make sure all files and assets are loaded.
-
Import the
StarRatingModule
in yourapp.module.ts
and set it asimport
under yourAppModule
configurations:// app.module.ts // Import the library import { StarRatingModule } from 'angular-star-rating'; @NgModule({ ... imports: [ ... // Use forRoot to import the StarRatingModule StarRatingModule.forRoot() ], ... }) export class AppModule { }
-
Once your library is imported, you are ready to use the components in your application:
<!-- app.component.html --> ... <star-rating [starType]="'svg'" [rating]="2.63"></star-rating>
If something is not working check if
- the component renders the expected html
- if you use the svg version check if the star-rating.icons.svg is present in your ./src/assets/images and loaded