You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

ngx-star-rating-updated

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

ngx-star-rating-updated

Simple Angular rating control from angular2 application using fontawesome icon. (Updated)

3.0.1
unpublished
latest
angular,rating,angular2,angular8,ngx-star-rating,ngx-rating, angular 8, angular 10, angular 11, angular 12, angular 13
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

ngx-star-rating (FORKED angular@latest)

Angular Star Rating (ngx star rating)

Simple Angular rating control from angular2 application using fontawesome icon.

Demo can be found here

ngx-star-rating angular rating

Installation

  • Install npm module:

    npm install ngx-star-rating --save

  • Include fontawesome css:

    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

Usage

Import NgxStarRatingModule module in your app, and use a component in your html:

  import { NgxStarRatingModule } from 'ngx-star-rating';
  
  // Include tag into your component
  <ngx-star-rating [formControl]="rating" [id]="'rating'" [disabled]="true"></ngx-star-rating>
 
 
  • <ngx-star-rating>:
    • `[(ngModel)] | formControl = ngModel or formControl

    • '[id] = Unique id for each control

    • [disabled]="true|false" = Enable/Disable star rating. Default is false.

Sample

// app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { NgxStarRatingModule } from 'ngx-star-rating';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    NgxStarRatingModule,
    FormsModule,
    ReactiveFormsModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

// app.component.ts
import { Component } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],

})
export class AppComponent {
  public form: FormGroup;

  constructor(private fb: FormBuilder){
    this.rating3 = 0;
    this.form = this.fb.group({
      rating: ['', Validators.required],
    })
  }
}

// app.component.html
<form [formGroup]="form">
    <ngx-star-rating formControlName="rating" [id]="'rating'"></ngx-star-rating>
    <div>Rating: {{form.value.rating}}</div>
    <p>form is valid: {{ form.valid ? 'true' : 'false' }}</p>
</form>

Keywords

angular

FAQs

Package last updated on 29 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts