To make json web token authentication, we need to pass token to the server. It is convenient to make this token logic independent of each api call so that it is global. An interceptor intercept all request outgoing or ingoing to make modification to them. So we can create a service that deal with interception.
The purpose of the action file is to define actions of which to take effects. In a typical page where we have to load specific data. We have 3 basics actions :
The page loading itself (start with On)
The action of loading the data (start with Load)
The action of receiving the data (end with Loaded)
An other convention used in this file is :
to end type representing object received from the server my MD. (Model data)
To end type representing object sent to the server by TO (Transfer Object)
Allow to define an async variable globally in a structural directive (ngFor, ngIf)
Template variable #myvar is accessible in the component js, with @viewchild and elementRef. Here is an example code snippet.