Sample Angular 8 Program To Use templateUrl.

What is templateUrl?.

templateUrl is an option of component decorator in angular, which will take relative or absolute URL as value for navigating control to respective template file.

app.component.ts:-

import { Component } from ‘@angular/core’;

@Component({
selector: ‘app-root’,
templateUrl: ‘./app.component.html’
})
export class AppComponent {
title = ‘Whatsmysuggestion’;
}

app.component.html

Welcome to {{ title }}!

Leave a Reply

Your email address will not be published. Required fields are marked *