How to create a registration form using Angular 8 and Kendo UI

Originally published by Jason Watmore at https://www.telerik.com/

Note: This example was built with Angular 8.1.0

This is a quick example of how to set up form validation in Angular 8 with Kendo UI components and Reactive Forms. The example is a simple registration form with pretty standard fields for title, first name, last name, email, password, confirm password and an accept Ts & Cs switch control. All fields are required, including the switch control. The email field must be a valid email address and the password field must have a mininimum length of 6 characters. There’s also a custom validator called MustMatch, which is used to validate that the password and confirm password fields match.

I’ve set up the form validation messages to display when the user attempts to submit the form. This is implemented with a submitted property in the app component that is set to true when the form is submitted, and reset to false if the cancel button is clicked.

The following Kendo UI components are used in the form:

  • kendo-dropdownlist is used for the Title field
  • kendoTextBox is used for the First Name, Last Name and Email fields
  • kendoTextBox with type="password" is used for the Password and Confirm Password fields
  • kendo-switch is used for the Accept Ts & Cs field
  • kendoButton is used for the Register and Cancel buttons

Styling of the example is done with Bootstrap 4.3, the Kendo UI for Angular Default Theme, and a few custom CSS styles in the main index.html file.

Here it is in action:https://stackblitz.com/edit/angular-8-kendo-ui-reactive-form-validation

Angular + Kendo UI App Component

The app component defines the form fields and validators for our registration form using an Angular FormBuilder to create an instance of a FormGroup that is stored in the registerForm property. The registerForm is then bound to the form in the app template below using the [formGroup] directive.

The titles array is bound to the kendo-dropdownlist in the app component template with the [data]="titles" property.

I also added a getter f as a convenience property to make it easier to access form controls from the template. So for example you can access the confirmPassword field in the template using f.confirmPassword instead of registerForm.controls.confirmPassword.

import { Component, OnInit } from '@angular/core';

import { FormBuilder, FormGroup, Validators } from ‘@angular/forms’;

 

// import custom validator to validate that password and confirm password fields match

import { MustMatch } from ‘./_helpers/must-match.validator’;

 

@Component({ selector: ‘app’, templateUrl: ‘app.component.html’ })

export class AppComponent implements OnInit {

    registerForm: FormGroup;

    submitted = false;

    titles = [‘Mr’, ‘Mrs’, ‘Miss’, ‘Ms’];

 

    constructor(private formBuilder: FormBuilder) { }

 

    ngOnInit() {

        this.registerForm = this.formBuilder.group({

            title: [‘’, Validators.required],

            firstName: [‘’, Validators.required],

            lastName: [‘’, Validators.required],

            email: [‘’, [Validators.required, Validators.email]],

            password: [‘’, [Validators.required, Validators.minLength(6)]],

            confirmPassword: [‘’, Validators.required],

            acceptTerms: [false, Validators.requiredTrue]

        }, {

            validator: MustMatch(‘password’, ‘confirmPassword’)

        });

    }

 

    // convenience getter for easy access to form fields

    get f() { return this.registerForm.controls; }

 

    onSubmit() {

        this.submitted = true;

 

        // stop here if form is invalid

        if (this.registerForm.invalid) {

            return;

        }

 

        // display form values on success

        alert(‘SUCCESS!! :-)\n\n’ + JSON.stringify(this.registerForm.value, null, 4));

    }

 

    onReset() {

        this.submitted = false;

        this.registerForm.reset();

    }

}

Angular + Kendo UI App Component Template

The app component template contains all the HTML markup and Angular template syntax for displaying the example registration form in your browser. The form element uses the [formGroup] directive to bind to the registerForm FormGroup in the app component above.

The form binds the form submit event to the onSubmit() handler in the app component using the Angular event binding (ngSubmit)=“onSubmit()”. Validation messages are displayed only after the user attempts to submit the form for the first time; this is controlled with the submitted property of the app component.

The cancel button click event is bound to the onReset() handler in the app component using the Angular event binding (click)=“onReset()”.

<!-- main app container -->
<div class=“card m-3”>
    <h5 class=“card-header”>Angular 8 + Kendo UI - Reactive Form Validation</h5>
    <div class=“card-body”>
        <form [formGroup]=“registerForm” (ngSubmit)=“onSubmit()”>
            <div class=“form-row”>
                <div class=“form-group col”>
                    <label>Title</label>
                    <kendo-dropdownlist formControlName=“title” [data]=“titles” class=“form-control” [ngClass]=“{ ‘ng-invalid ng-touched’: submitted && f.title.errors }”>
                    </kendo-dropdownlist>
                    <div *ngIf=“submitted && f.title.errors” class=“k-tooltip-validation”>
                        <div *ngIf=“f.title.errors.required”>Title is required</div>
                    </div>
                </div>
                <div class=“form-group col-5”>
                    <label>First Name</label>
                    <input kendoTextBox formControlName=“firstName” class=“form-control” [ngClass]=“{ ‘ng-invalid ng-touched’: submitted && f.firstName.errors }” />
                    <div *ngIf=“submitted && f.firstName.errors” class=“k-tooltip-validation”>
                        <div *ngIf=“f.firstName.errors.required”>First Name is required</div>
                    </div>
                </div>
                <div class=“form-group col-5”>
                    <label>Last Name</label>
                    <input kendoTextBox formControlName=“lastName” class=“form-control” [ngClass]=“{ ‘ng-invalid ng-touched’: submitted && f.lastName.errors }” />
                    <div *ngIf=“submitted && f.lastName.errors” class=“k-tooltip-validation”>
                        <div *ngIf=“f.lastName.errors.required”>Last Name is required</div>
                    </div>
                </div>
            </div>
            <div class=“form-group”>
                <label>Email</label>
                <input kendoTextBox formControlName=“email” class=“form-control” [ngClass]=“{ ‘ng-invalid ng-touched’: submitted && f.email.errors }” />
                <div *ngIf=“submitted && f.email.errors” class=“k-tooltip-validation”>
                    <div *ngIf=“f.email.errors.required”>Email is required</div>
                    <div *ngIf=“f.email.errors.email”>Email must be a valid email address</div>
                </div>
            </div>
            <div class=“form-row”>
                <div class=“form-group col”>
                    <label>Password</label>
                    <input kendoTextBox type=“password” formControlName=“password” class=“form-control” [ngClass]=“{ ‘ng-invalid ng-touched’: submitted && f.password.errors }” />
                    <div *ngIf=“submitted && f.password.errors” class=“k-tooltip-validation”>
                        <div *ngIf=“f.password.errors.required”>Password is required</div>
                        <div *ngIf=“f.password.errors.minlength”>Password must be at least 6 characters</div>
                    </div>
                </div>
                <div class=“form-group col”>
                    <label>Confirm Password</label>
                    <input kendoTextBox type=“password” formControlName=“confirmPassword” class=“form-control” [ngClass]=“{ ‘ng-invalid ng-touched’: submitted && f.confirmPassword.errors }” />
                    <div *ngIf=“submitted && f.confirmPassword.errors” class=“k-tooltip-validation”>
                        <div *ngIf=“f.confirmPassword.errors.required”>Confirm Password is required</div>
                        <div *ngIf=“f.confirmPassword.errors.mustMatch”>Passwords must match</div>
                    </div>
                </div>
            </div>
            <div class=“form-group”>
                <kendo-switch formControlName=“acceptTerms” onLabel=“Yes”
         offLabel=“No”></kendo-switch>
                <label>Accept Terms & Conditions</label>
                <div *ngIf=“submitted && f.acceptTerms.errors” class=“k-tooltip-validation”>Accept Ts & Cs is required</div>
            </div>
            <div class=“text-center”>
                <button kendoButton primary=“true” class=“mr-2”>Register</button>
                <button kendoButton type=“reset” (click)=“onReset()”>Cancel</button>
            </div>
        </form>
    </div>
</div>

Reactive Forms Custom “Must Match” Validator

The custom MustMatch validator is used in this example to verify that both of the password fields (password and confirmPassword) match. It could also be used to verify that any pair of fields match (e.g. email and confirm email fields).

It works slightly differently than a typical custom validator because I’m setting the error on the second field instead of returning it to be set on the formGroup. I did it this way because I think it makes the template a bit cleaner and more intuitive. The mustMatch validation error is displayed below the confirmPassword field, so I think it makes sense that the error is attached the the confirmPassword form control.

import { FormGroup } from ‘@angular/forms’;
 
// custom validator to check that two fields match
export function MustMatch(controlName: string, matchingControlName: string) {
    return (formGroup: FormGroup) => {
        const control = formGroup.controls[controlName];
        const matchingControl = formGroup.controls[matchingControlName];
 
        if (matchingControl.errors && !matchingControl.errors.mustMatch) {
            // return if another validator has already found an error on the matchingControl
            return;
        }
 
        // set error on matchingControl if validation fails
        if (control.value !== matchingControl.value) {
            matchingControl.setErrors({ mustMatch: true });
        } else {
            matchingControl.setErrors(null);
        }
    }
}

Angular + Kendo UI App Module

There isn’t much going on in the app module other than the standard stuff. The main thing you need to remember for using reactive forms in Angular is to import the ReactiveFormsModule from ‘@angular/forms’ and include it in the imports array of the @NgModule decorator.

To use Kendo UI components for Angular, import the modules that contain the components you want to use and include them in the imports array of the @NgModule decorator. The example uses Kendo UI components from the InputsModule, DropDownsModule and ButtonsModule.

import { NgModule } from ‘@angular/core’;
import { BrowserModule } from ‘@angular/platform-browser’;
import { ReactiveFormsModule } from ‘@angular/forms’;
import { BrowserAnimationsModule } from ‘@angular/platform-browser/animations’;
 
import { InputsModule } from ‘@progress/kendo-angular-inputs’;
import { DropDownsModule } from ‘@progress/kendo-angular-dropdowns’;
import { ButtonsModule } from ‘@progress/kendo-angular-buttons’;
 
import { AppComponent } from ‘./app.component’;
 
@NgModule({
    imports: [
        BrowserModule,
        ReactiveFormsModule,
        BrowserAnimationsModule,
        InputsModule,
        DropDownsModule,
        ButtonsModule
    ],
    declarations: [
        AppComponent
    ],
    bootstrap: [AppComponent]
})
export class AppModule { }

Thanks for reading

If you liked this post, share it with all of your programming buddies!

Follow us on Facebook | Twitter

Further reading about Angular

Angular 8 (formerly Angular 2) - The Complete Guide

Angular & NodeJS - The MEAN Stack Guide

The Complete Node.js Developer Course (3rd Edition)

The Web Developer Bootcamp

Best 50 Angular Interview Questions for Frontend Developers in 2019

How to build a CRUD Web App with Angular 8.0

React vs Angular: An In-depth Comparison

React vs Angular vs Vue.js by Example

Microfrontends — Connecting JavaScript frameworks together (React, Angular, Vue etc)

Building CRUD Mobile App using Ionic 4, Angular 8

#angular #web-development #javascript #forms

What is GEEK

Buddha Community

How to create a registration form using Angular 8 and Kendo UI

Kerelos Nasr

1572328794

***can you please make a youtube channel for new people (the startup people can’t understand the documents thats why they need youtube) and thank for this post i like it ***

Yogi Gurjar

1600307723

Laravel 8 Form Example Tutorial - Complete Guide

Laravel 8 form example. In this tutorial, i would love to show you how to create form in laravel. And how to insert data into database using form in laravel 8.

How to Submit Form Data into Database in Laravel 8

  1. Step 1 – Install Laravel 8 Application
  2. Step 2 – Configuring Database using Env File
  3. Step 3 – Create Model & Migration File For Add Blog Post Form
  4. Step 4 – Create Routes
  5. Step 5 – Creating Controller
  6. Step 6 – Create Blade File For Add Blog Post Form
  7. Step 7 – Start Development Server
  8. Step 8 – Run Laravel 8 Form App On Browser

https://laratutorials.com/laravel-8-form-example-tutorial/

#insert form data into database using laravel #laravel bootstrap form #laravel post forms #laravel 8 form tutorial #laravel 8 form example #laravel 8 form submit tutorial

Yogi Gurjar

1600308055

Laravel 8 Form Validation Tutorial

Laravel 8 form validation example. In this tutorial, i will show you how to submit form with validation in laravel 8.

And you will learn how to store form data in laravel 8. Also validate form data before store to db.

How to Validate Form Data in Laravel 8

  1. Step 1 – Install Laravel 8 Application
  2. Step 2 – Configuring Database using Env File
  3. Step 3 – Create Model & Migration File For Form
  4. Step 4 – Create Routes
  5. Step 5 – Creating Controller
  6. Step 6 – Create Blade File For Form
  7. Step 7 – Start Development Server
  8. Step 8 – Run Laravel 8 Form Validation App On Browser

https://laratutorials.com/laravel-8-form-validation-example-tutorial/

#laravel 8 form validation #laravel 8 form validation tutorial #laravel 8 form validation - google search #how to validate form data in laravel 8 #form validation in laravel 8

How to create a registration form using Angular 8 and Kendo UI

Originally published by Jason Watmore at https://www.telerik.com/

Note: This example was built with Angular 8.1.0

This is a quick example of how to set up form validation in Angular 8 with Kendo UI components and Reactive Forms. The example is a simple registration form with pretty standard fields for title, first name, last name, email, password, confirm password and an accept Ts & Cs switch control. All fields are required, including the switch control. The email field must be a valid email address and the password field must have a mininimum length of 6 characters. There’s also a custom validator called MustMatch, which is used to validate that the password and confirm password fields match.

I’ve set up the form validation messages to display when the user attempts to submit the form. This is implemented with a submitted property in the app component that is set to true when the form is submitted, and reset to false if the cancel button is clicked.

The following Kendo UI components are used in the form:

  • kendo-dropdownlist is used for the Title field
  • kendoTextBox is used for the First Name, Last Name and Email fields
  • kendoTextBox with type="password" is used for the Password and Confirm Password fields
  • kendo-switch is used for the Accept Ts & Cs field
  • kendoButton is used for the Register and Cancel buttons

Styling of the example is done with Bootstrap 4.3, the Kendo UI for Angular Default Theme, and a few custom CSS styles in the main index.html file.

Here it is in action:https://stackblitz.com/edit/angular-8-kendo-ui-reactive-form-validation

Angular + Kendo UI App Component

The app component defines the form fields and validators for our registration form using an Angular FormBuilder to create an instance of a FormGroup that is stored in the registerForm property. The registerForm is then bound to the form in the app template below using the [formGroup] directive.

The titles array is bound to the kendo-dropdownlist in the app component template with the [data]="titles" property.

I also added a getter f as a convenience property to make it easier to access form controls from the template. So for example you can access the confirmPassword field in the template using f.confirmPassword instead of registerForm.controls.confirmPassword.

import { Component, OnInit } from '@angular/core';

import { FormBuilder, FormGroup, Validators } from ‘@angular/forms’;

 

// import custom validator to validate that password and confirm password fields match

import { MustMatch } from ‘./_helpers/must-match.validator’;

 

@Component({ selector: ‘app’, templateUrl: ‘app.component.html’ })

export class AppComponent implements OnInit {

    registerForm: FormGroup;

    submitted = false;

    titles = [‘Mr’, ‘Mrs’, ‘Miss’, ‘Ms’];

 

    constructor(private formBuilder: FormBuilder) { }

 

    ngOnInit() {

        this.registerForm = this.formBuilder.group({

            title: [‘’, Validators.required],

            firstName: [‘’, Validators.required],

            lastName: [‘’, Validators.required],

            email: [‘’, [Validators.required, Validators.email]],

            password: [‘’, [Validators.required, Validators.minLength(6)]],

            confirmPassword: [‘’, Validators.required],

            acceptTerms: [false, Validators.requiredTrue]

        }, {

            validator: MustMatch(‘password’, ‘confirmPassword’)

        });

    }

 

    // convenience getter for easy access to form fields

    get f() { return this.registerForm.controls; }

 

    onSubmit() {

        this.submitted = true;

 

        // stop here if form is invalid

        if (this.registerForm.invalid) {

            return;

        }

 

        // display form values on success

        alert(‘SUCCESS!! :-)\n\n’ + JSON.stringify(this.registerForm.value, null, 4));

    }

 

    onReset() {

        this.submitted = false;

        this.registerForm.reset();

    }

}

Angular + Kendo UI App Component Template

The app component template contains all the HTML markup and Angular template syntax for displaying the example registration form in your browser. The form element uses the [formGroup] directive to bind to the registerForm FormGroup in the app component above.

The form binds the form submit event to the onSubmit() handler in the app component using the Angular event binding (ngSubmit)=“onSubmit()”. Validation messages are displayed only after the user attempts to submit the form for the first time; this is controlled with the submitted property of the app component.

The cancel button click event is bound to the onReset() handler in the app component using the Angular event binding (click)=“onReset()”.

<!-- main app container -->
<div class=“card m-3”>
    <h5 class=“card-header”>Angular 8 + Kendo UI - Reactive Form Validation</h5>
    <div class=“card-body”>
        <form [formGroup]=“registerForm” (ngSubmit)=“onSubmit()”>
            <div class=“form-row”>
                <div class=“form-group col”>
                    <label>Title</label>
                    <kendo-dropdownlist formControlName=“title” [data]=“titles” class=“form-control” [ngClass]=“{ ‘ng-invalid ng-touched’: submitted && f.title.errors }”>
                    </kendo-dropdownlist>
                    <div *ngIf=“submitted && f.title.errors” class=“k-tooltip-validation”>
                        <div *ngIf=“f.title.errors.required”>Title is required</div>
                    </div>
                </div>
                <div class=“form-group col-5”>
                    <label>First Name</label>
                    <input kendoTextBox formControlName=“firstName” class=“form-control” [ngClass]=“{ ‘ng-invalid ng-touched’: submitted && f.firstName.errors }” />
                    <div *ngIf=“submitted && f.firstName.errors” class=“k-tooltip-validation”>
                        <div *ngIf=“f.firstName.errors.required”>First Name is required</div>
                    </div>
                </div>
                <div class=“form-group col-5”>
                    <label>Last Name</label>
                    <input kendoTextBox formControlName=“lastName” class=“form-control” [ngClass]=“{ ‘ng-invalid ng-touched’: submitted && f.lastName.errors }” />
                    <div *ngIf=“submitted && f.lastName.errors” class=“k-tooltip-validation”>
                        <div *ngIf=“f.lastName.errors.required”>Last Name is required</div>
                    </div>
                </div>
            </div>
            <div class=“form-group”>
                <label>Email</label>
                <input kendoTextBox formControlName=“email” class=“form-control” [ngClass]=“{ ‘ng-invalid ng-touched’: submitted && f.email.errors }” />
                <div *ngIf=“submitted && f.email.errors” class=“k-tooltip-validation”>
                    <div *ngIf=“f.email.errors.required”>Email is required</div>
                    <div *ngIf=“f.email.errors.email”>Email must be a valid email address</div>
                </div>
            </div>
            <div class=“form-row”>
                <div class=“form-group col”>
                    <label>Password</label>
                    <input kendoTextBox type=“password” formControlName=“password” class=“form-control” [ngClass]=“{ ‘ng-invalid ng-touched’: submitted && f.password.errors }” />
                    <div *ngIf=“submitted && f.password.errors” class=“k-tooltip-validation”>
                        <div *ngIf=“f.password.errors.required”>Password is required</div>
                        <div *ngIf=“f.password.errors.minlength”>Password must be at least 6 characters</div>
                    </div>
                </div>
                <div class=“form-group col”>
                    <label>Confirm Password</label>
                    <input kendoTextBox type=“password” formControlName=“confirmPassword” class=“form-control” [ngClass]=“{ ‘ng-invalid ng-touched’: submitted && f.confirmPassword.errors }” />
                    <div *ngIf=“submitted && f.confirmPassword.errors” class=“k-tooltip-validation”>
                        <div *ngIf=“f.confirmPassword.errors.required”>Confirm Password is required</div>
                        <div *ngIf=“f.confirmPassword.errors.mustMatch”>Passwords must match</div>
                    </div>
                </div>
            </div>
            <div class=“form-group”>
                <kendo-switch formControlName=“acceptTerms” onLabel=“Yes”
         offLabel=“No”></kendo-switch>
                <label>Accept Terms & Conditions</label>
                <div *ngIf=“submitted && f.acceptTerms.errors” class=“k-tooltip-validation”>Accept Ts & Cs is required</div>
            </div>
            <div class=“text-center”>
                <button kendoButton primary=“true” class=“mr-2”>Register</button>
                <button kendoButton type=“reset” (click)=“onReset()”>Cancel</button>
            </div>
        </form>
    </div>
</div>

Reactive Forms Custom “Must Match” Validator

The custom MustMatch validator is used in this example to verify that both of the password fields (password and confirmPassword) match. It could also be used to verify that any pair of fields match (e.g. email and confirm email fields).

It works slightly differently than a typical custom validator because I’m setting the error on the second field instead of returning it to be set on the formGroup. I did it this way because I think it makes the template a bit cleaner and more intuitive. The mustMatch validation error is displayed below the confirmPassword field, so I think it makes sense that the error is attached the the confirmPassword form control.

import { FormGroup } from ‘@angular/forms’;
 
// custom validator to check that two fields match
export function MustMatch(controlName: string, matchingControlName: string) {
    return (formGroup: FormGroup) => {
        const control = formGroup.controls[controlName];
        const matchingControl = formGroup.controls[matchingControlName];
 
        if (matchingControl.errors && !matchingControl.errors.mustMatch) {
            // return if another validator has already found an error on the matchingControl
            return;
        }
 
        // set error on matchingControl if validation fails
        if (control.value !== matchingControl.value) {
            matchingControl.setErrors({ mustMatch: true });
        } else {
            matchingControl.setErrors(null);
        }
    }
}

Angular + Kendo UI App Module

There isn’t much going on in the app module other than the standard stuff. The main thing you need to remember for using reactive forms in Angular is to import the ReactiveFormsModule from ‘@angular/forms’ and include it in the imports array of the @NgModule decorator.

To use Kendo UI components for Angular, import the modules that contain the components you want to use and include them in the imports array of the @NgModule decorator. The example uses Kendo UI components from the InputsModule, DropDownsModule and ButtonsModule.

import { NgModule } from ‘@angular/core’;
import { BrowserModule } from ‘@angular/platform-browser’;
import { ReactiveFormsModule } from ‘@angular/forms’;
import { BrowserAnimationsModule } from ‘@angular/platform-browser/animations’;
 
import { InputsModule } from ‘@progress/kendo-angular-inputs’;
import { DropDownsModule } from ‘@progress/kendo-angular-dropdowns’;
import { ButtonsModule } from ‘@progress/kendo-angular-buttons’;
 
import { AppComponent } from ‘./app.component’;
 
@NgModule({
    imports: [
        BrowserModule,
        ReactiveFormsModule,
        BrowserAnimationsModule,
        InputsModule,
        DropDownsModule,
        ButtonsModule
    ],
    declarations: [
        AppComponent
    ],
    bootstrap: [AppComponent]
})
export class AppModule { }

Thanks for reading

If you liked this post, share it with all of your programming buddies!

Follow us on Facebook | Twitter

Further reading about Angular

Angular 8 (formerly Angular 2) - The Complete Guide

Angular & NodeJS - The MEAN Stack Guide

The Complete Node.js Developer Course (3rd Edition)

The Web Developer Bootcamp

Best 50 Angular Interview Questions for Frontend Developers in 2019

How to build a CRUD Web App with Angular 8.0

React vs Angular: An In-depth Comparison

React vs Angular vs Vue.js by Example

Microfrontends — Connecting JavaScript frameworks together (React, Angular, Vue etc)

Building CRUD Mobile App using Ionic 4, Angular 8

#angular #web-development #javascript #forms

How to Design Login Page using Xamarin Forms C# | Login Form | Sign In UI Design

#xamarin
#aspdotnetexplorer
https://www.youtube.com/watch?v=2tehSdX897E

#xamarin forms #xamarin forms bangla tutorials for beginners #xamarin forms tutorials for beginners #xamarin #xamarin.forms #xamarin.forms ui

Christa  Stehr

Christa Stehr

1598940617

Install Angular - Angular Environment Setup Process

Angular is a TypeScript based framework that works in synchronization with HTML, CSS, and JavaScript. To work with angular, domain knowledge of these 3 is required.

  1. Installing Node.js and npm
  2. Installing Angular CLI
  3. Creating workspace
  4. Deploying your First App

In this article, you will get to know about the Angular Environment setup process. After reading this article, you will be able to install, setup, create, and launch your own application in Angular. So let’s start!!!

Angular environment setup

Install Angular in Easy Steps

For Installing Angular on your Machine, there are 2 prerequisites:

  • Node.js
  • npm Package Manager
Node.js

First you need to have Node.js installed as Angular require current, active LTS or maintenance LTS version of Node.js

Download and Install Node.js version suitable for your machine’s operating system.

Npm Package Manager

Angular, Angular CLI and Angular applications are dependent on npm packages. By installing Node.js, you have automatically installed the npm Package manager which will be the base for installing angular in your system. To check the presence of npm client and Angular version check of npm client, run this command:

  1. npm -v

Installing Angular CLI

  • Open Terminal/Command Prompt
  • To install Angular CLI, run the below command:
  1. npm install -g @angular/cli

installing angular CLI

· After executing the command, Angular CLI will get installed within some time. You can check it using the following command

  1. ng --version

Workspace Creation

Now as your Angular CLI is installed, you need to create a workspace to work upon your application. Methods for it are:

  • Using CLI
  • Using Visual Studio Code
1. Using CLI

To create a workspace:

  • Navigate to the desired directory where you want to create your workspace using cd command in the Terminal/Command prompt
  • Then in the directory write this command on your terminal and provide the name of the app which you want to create. In my case I have mentioned DataFlair:
  1. Ng new YourAppName

create angular workspace

  • After running this command, it will prompt you to select from various options about the CSS and other functionalities.

angular CSS options

  • To leave everything to default, simply press the Enter or the Return key.

angular setup

#angular tutorials #angular cli install #angular environment setup #angular version check #download angular #install angular #install angular cli