Angular’s template syntax

Angular’s template syntax:

  • [property]="expression": set property of an element to the value of expression
  • (event)="statement": execute statement when event occurred
  • [(property)]="expression": create two-way binding with expression
  • [class.special]="expression": add special CSS class to element when the value of expression is truthy
  • [style.color]="expression": set color CSS property to the value of expression

If you’re not familiar with Angular’s template syntax, you should definitely read the official template syntax documentation.

Our new TECH STACK

We have been undergoing a major upgrade to our tech stack and here is what we are implementing now…  WOOT WOOT

 

stack1

žCloud Formation – A service that allows the entire stack to be built, provisioned, provisioned, and torn down demand.

žELB – A load balancer that works with autoscaling to create and destroy servers as needed by the traffic load.

žEC2 – Cloud-based virtual machines.

žEFS – A network file system that allows multiple EC2 instances to share a file system, even across availability zones.

žS3 – A Simple Storage Service designed to hold static resources, such as images and documents.

žRDS – Relational Database Services that cross availability zones, provide high availability, provide fail-over, and provide backup.

Angular2 Constructor Guards…

Right from the angular docs

You can use this method to prevent accidental loading of a previously loaded module..

How can I tell if a module or service was previously loaded?

Some modules and its services should only be loaded once by the root AppModule. Importing the module a second time by lazy loading a module could produce errant behavior that may be difficult to detect and diagnose.

We can guard against that danger by writing a constructor that attempts to inject the module or service from the root app injector. If the injection succeeds, the class has been loaded a second time. We can throw an error or take other remedial action.

Certain Angular modules (such as BrowserModule) implements such a guard as does this Angular Module chapter sample’s CoreModule constructor.

app/core/core.module.ts
constructor (@Optional() @SkipSelf() parentModule: CoreModule) {
 if (parentModule) {
 throw new Error(
 'CoreModule is already loaded. Import it in the AppModule only');
 }
}