3. template and template url

TEMPLATE WITH SINGLE LINE CAN BE USED SINGLE OR DOUBLE QUOTES
import { Component } from '@angular/core';
@Component({
selector:'app-root',
template:"hi {{title}}"
})

export class AppComponent{
title:string ='angular';
}
TEMPLATE MORE THAN 1 LINE USED BACKTICKS
import { Component } from '@angular/core';
@Component({
selector:'app-root',
template:`hi {{title}}
ABC
XYZ`
})

export class AppComponent{
title:string ='angular';
}
USING TEMPLATEURL
import { Component } from '@angular/core';
@Component({
selector:'app-root',
templateUrl:'./app.component.html'
})

export class AppComponent{
title:string ='angular';
}

Comments

Popular posts from this blog

reactjs questions part 4

ReactJS: How and when to force a React component to re-render

Q: Error Boundary in React that catches an error and displays a fallback UI