Skip to main content

Posts

Showing posts with the label template vs. templateUrl

Angular Templates - template vs. templateUrl? How to Use Inline and External Templates?

A template is a HTML view that tells Angular for render your components in the views. The templateUrl - The relative path or absolute URL of a template file for an Angular component. If provided, do not supply an inline template using template. The template - An inline template for an Angular component If provided, do not supply a template file using templateUrl. When to use templateUrl in Angular applications? When you have a complex view, then it recommended by Angular to create that complex view in an external HTML file instead of an inline template. The Angular component decorator provides a property called templateUrl. This property takes the path of an external HTML file. The Angular templates are very similar to Angularjs but Angular has some small syntactical changes.                          You can see the changes as below, 1.          {} : Is ...