Component class methods in Angular template
In the layout, you can also call public methods of the class. Let's see in practice. Let's say we have the following method:
export class AppComponent {
public show() {
return 'abcde';
}
}
Let's call it in the layout:
<div>
{{ show() }}
</div>
Let the component class have the following methods:
export class AppComponent {
public showName() {
return 'john';
}
public showSurn() {
return 'smit';
}
}
Display the first and last name in the component template file.