HTML 5 Validation Attributes required pattern minlength maxlength min max Step 1: user-settings-form.component.html file Step 2: user-settings-form.component.html file Step 3: user-settings-form.component.html file Step 4: user-settings-form.component.html file
Month: December 2019
HTTP access using HttpClient in Angular
Step 1: app.module.ts file Step 2: data.service.ts file
Retrieving data for Select elements
Step 1: user-settings-form.component.ts file Step 2: data.service.ts file Step 3: user-settings-form.component.html file
Creating a Service in Angular
Step 1: create a data-service.ts file in data folder Note: ng command – ng g s data import user-settings file Step 2: in user-settings-form.component.ts file import bellow those two files Step 3: in user-settings-form.component.html file {{userSettings | json}}
Creating a Data Model in Angular
Step 1: create user-settings.ts file in data folder then write bellow code Step 2: define user-settings-form.component file but before import user-settings file Step 3: using in html file for two way binding (user-settings-form.component.html) {{userSettings | json}}
Angular Form Technologies
Template-driven Forms Use a Component’s Template Unit Test Against DOM Reactive Forms Use a Component’s Template Create a Form Model in Typescript (this must by in sync with the template) Unit Test Against Form Model Validation in Form Model
Angular CLI Generate Code
class – ng g cl component – ng g c directive – ng g d enum – ng g e guard – ng g g interface – ng g i module – ng g m pipe – ng g p service – ng g s
Angular CLI Commands
ng help – Displasy commands and flags ng new – Creates new Angular application ng serve – Launches a server ng generate – Generates file from blueprint ng test – Runs unit tests usning Karma ng e2e – Runs end to end tests using Protractor ng build – Compiles into an output directory
Angular CLI overview
Angular CLI overview A command line interface for Angular Purpose: Build an Angular application Generate Angular files Execute the application Run unit and end to end tests Prepare the application for deployment