Open In App

Angular PrimeNG Form Knob Properties Component

Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. In this article, we will know how to use the InputNumber component in Angular PrimeNG. We will also learn about the properties, events, methods & styling along with their syntaxes that will be used in the code. 

The knob component is a form component that is used to define a dialer-type knob that contains labels and some data values.



Angular PrimeNG Form Knob Properties Component Properties:

 



Creating Angular Application & module Installation:

Step 1: Create an Angular application using the following command.

ng new appname

Step 2: After creating your project folder i.e. appname, move to it using the following command.

cd appname

Step 3: Install PrimeNG in your given directory.

npm install primeng --save
npm install primeicons --save

Project Structure: 

 

Example 1: In the below code, we will be using the above properties to demonstrate the use of the Form Knob Properties Component.




<div style="text-align:center">
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
    <h3>
        A computer science portal for geeks
    </h3>
    <h4>
        Angular PrimeNG Form Knob Properties Component
    </h4>
    <h5>disabled</h5>
    <div class="p-grid p-formgrid">
        <div class="p-field p-col-12 p-md-4">
            <p-knob 
                [(ngModel)]="value3" 
                disabled="true">
            </p-knob>
        </div>
    </div>
</div>




import { Component } from "@angular/core";
  
@Component({
    selector: "app-root",
    templateUrl: "./app.component.html"
})
export class AppComponent {
    value1: number = 0;
    value2: number = 50;
    value3: number = 75.5;
    value4: number = 10.5;
    value5: number = 40.5;
    value6: number = 60;
    value7: number = 40.5;
}




import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { FormsModule } from "@angular/forms";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { AppComponent } from "./app.component";
import { KnobModule } from "primeng/knob";
  
@NgModule({
    imports: [BrowserModule, BrowserAnimationsModule, KnobModule, FormsModule],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }

Output:

 

Example 2: In the below code, we will be using the above properties to demonstrate the use of the Form Knob Properties Component.




<div style="text-align:center">
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
    <h3>
        A computer science portal for geeks
    </h3>
    <h4>
        Angular PrimeNG Form Knob Properties Component
    </h4>
  
    <div class="p-grid p-formgrid">
        <div class="p-field p-col-12 p-md-4">
            <p-knob 
                [(ngModel)]="value4">
            </p-knob>
        </div>
    </div>
</div>




import { Component } from "@angular/core";
  
@Component({
    selector: "app-root",
    templateUrl: "./app.component.html"
})
export class AppComponent {
    value1: number = 0;
    value2: number = 50;
    value3: number = 75.5;
    value4: number = 10.5;
    value5: number = 40.5;
    value6: number = 60;
    value7: number = 40.5;
}




import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { FormsModule } from "@angular/forms";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { AppComponent } from "./app.component";
import { KnobModule } from "primeng/knob";
  
@NgModule({
    imports: [BrowserModule, BrowserAnimationsModule, KnobModule, FormsModule],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }

Output:

 

Reference: https://www.primefaces.org/primeng/knob


Article Tags :