Posted on14 Apr 2019 | Byadmin

The HttpInterceptor class was introduced in 4.3.

Posted on14 Apr 2019 | Byadmin

Route Guards

 

 

CanActivate

 

Posted on14 Apr 2019 | Byadmin

Base

The index page should contain a base reference to tell Angular the reference point to start all routes.

Example:

<base href="/">

Posted on13 Apr 2019 | Byadmin
Posted on13 Apr 2019 | Byadmin

Install the cli:

npm install -g @angular/cli

Create a new project and run it:

ng new my-first-project
cd my-first-project
ng serve

Build project for production:

ng build my-app -c production

 

 

Posted on13 Apr 2019 | Byadmin

Pipes in angular are for transforming data.  Pipes are denoted using the "|" character.  A commonly used pipe would be the upper case pipe which converts a string variable to all uppercase letters.

Example:

<h1>Uppercase Pipe</h1>

<b>{{title | uppercase}}</b>

Custom Pipe

To create a custom pipe a class is created decorated with @Pipe in a typescript file.

Example:

Posted on13 Apr 2019 | Byadmin
Posted on13 Apr 2019 | Byadmin

In reactive forms validator functions are added to the FormGroup object in the component class.  When a control value changes Angular will call the corresponding validator functions.

Sync Validators

Sync validator functions return either a set of validation errors or null.

Async Validators

Async validators functions return a promise or observable that will later emit null or a set of validation errors.

Posted on13 Apr 2019 | Byadmin

Form Model

Angular Reactive Forms requires a model be created specifically for the purpose of supporting the form.  this is usually referred to as the form model.  The main purpose of this is so that the original data object is not over written until the user wishes to submit the form.  Once submit is pressed on the form then the original data object is copied over with the data from the form model.  Overriding the object like this is referred to as "immutable objects"