Ionic 2 Component Inline Html


A lot of Ionic 2 and Angular 2 examples and tutorials use html template in Component javascript file by using “template” instead of “templateUrl”. Is this the best practice in Angular 2 or is it just for the sake of tutorial simplicity?

Example from website:
Angular 2 Tutorial Part-1

For me it depends on how much HTML the component is going to get. If its like two lines I find using templateUrl is a bit much. But if it is a more complex html component with more lines I find that creating a separate view and thus using `templateUrl is easier to maintain.

Futher in that tutorial they describe the templateUrl part =>

I think in tutorials its most used for tutorial simplicity :slight_smile: