Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngx-input-star-rating

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-input-star-rating

[![npm version](https://badge.fury.io/js/ngx-input-star-rating.svg)](https://badge.fury.io/js/ngx-input-star-rating)

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ngx-input-star-rating

npm version

A small star rating component compatible with both Angular Reactive Forms and Template Forms.

Demo

Installation

To install this library, run:

npm install ngx-input-star-rating --save

and then from your Angular AppModule:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { NgxInputStarRatingModule } from 'ngx-input-star-rating';

import { AppComponent } from './app.component';

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

Component

Once the library is imported, you can use the ngx-input-star-rating component.

import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { Observable } from 'rxjs/Observable';

@Component({
  selector: 'app-root',
  template: `
<h1>ngx-input-star-rating</h1>

<form [formGroup]="form" (ngSubmit)="submit()">
  <ngx-input-star-rating formControlName="rating"></ngx-input-star-rating>
  <button>Submit</button>
</form>
  `
})
export class AppComponent implements OnInit {
  form: FormGroup;
  value: Observable<number>;

  constructor(private formBuilder: FormBuilder) { }

  ngOnInit() {
    this.form = this.formBuilder.group({
      rating: [3]
    });

    this.value = this.form.controls.rating.valueChanges;
  }

  submit() {
    console.log(this.form.value);
  }
}

License

MIT © Cory Rylan

FAQs

Package last updated on 20 Mar 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc