What are macros?
The AOT compiler supports macros in the form of functions or static methods that return an expression in a single return expression
. For example, let us take a below macro function,
export function wrapInArray<T>(value: T): T[] {return [value];}
You can use it inside metadata as an expression,
@NgModule({declarations: wrapInArray(TypicalComponent),})export class TypicalModule {}
The compiler treats the macro expression as it written directly
@NgModule({declarations: [TypicalComponent],})export class TypicalModule {}
February 17, 2022
624
Read more
What is Angular Framework?
November 04, 2022
AngularWhat is a Angular module?
November 03, 2022
AngularWhat are the steps to use animation module?
October 31, 2022
Angular