@Component decorator is a function , and it has got two template properties one is template and the other is templateURL
Different ways to create Templates in Angular
- Inline template
- External Template
Using double quotes:
You can also replace the above HTML Code within a pair of double quotes as shown below and it also work as expected.
When you have multiple lines of HTML code then you need to use the tilt otherwise you will get a compile-time error as shown in the below image.
External Template:
The External templates define the HTML in a separate file and refer to that file using templateUrl property of Component decorator
When you have a complex view, then it is recommended by angular to create that complex view in an external HTML File instead of an inline template
Output
No comments:
Post a Comment
Thank you for visiting my blog