By reading title of this post, It seems some what misleading. In Angular 2 (or higher version for that matter). We cannot directly access Enum or any other type for that matter into template.
so, for an example consider following example
now if we try to access Enum WeekDays in HTML template as follows
It would be resulted in runtime error shown below
To resolve this error we should be assigning enum to component property as shown below.
Reason behind this is , Component is the execution context for an Angular application. We can reference only those properties in template which are defined in component or have scope in component.
Thanks for sharing this typescript concepts. Step by Step coding clearly explains coding. Keep up the good work and share more like this.
ReplyDeleteAngularjs Training in Chennai | Angular 2 Training in Chennai
If you want to create a responsive HTML templates, then I think you will find these templates useful These are simple colorful graphic tools that will help make any report or presentation the most interesting for the audience. Try it.
ReplyDeleteInformative and impressive blog.. Keep blogging..
ReplyDeleteExcel Training in Chennai
VBA Excel Macro Training in Chennai
MOS Certification Training in Chennai