Configure URL from server before http-request in Angular

Configure URL from server before http-request in Angular

For an angular application which is deployed inhouse to several customers,
the application has to figure out, where the backend server exists.

Setting the url in the environment was not useful, as each customer needs
his own url and this would end up in big build scripts.

Also the customer could not reorganize the server names on his own, without
breaking the application if he chooses to change the server name.

So we tried to be clever and to figure out where the server might be in
loading a configuration file from an untouched json file in the application.

find json file with url in application diagram

Or

Read More

Angular ControlValueAccessor by example

Angular ControlValueAccessor by example

At sLAB we currently develop an angular client for the sMOTIVE product. We wanted to extend some form controls with own behavior and had some issues with the ControlValueAccessor.

The ControlValueAccessor is Angulars interface to interact with a form control.

I did some investigations with plunker to address those issues.

plunker screenshot

  1. Outer component containing the form.
  2. Shows the properties of the form and the 'business model' (value).
  3. The form control implementing the ControlValueAccessor interface.
  4. These buttons trigger changes inside the control.
  5. The buttons trigger changes from the outer component.

my-input.component.ts

export class MyInputComponent implements ControlValueAccessor {  
  myValue: any = null;
  propagateChange

Read More