Variable Call

export class TestComponent implements OnInit {

      // public variable

public name ='Maruf Al Bashir';

constructor() { }

  ngOnInit(): void {

  }

}

 

Show The Variable in HTML

{{name}}

 

Then the output is

Name: Maruf Al Bashir

Other operation of a variable

{{name.length}} value length

{{name.toUpperCase}}

{{name.toLowerCase}}

 

Methods

In component.ts file create a new method

 greetUser(){

    return 'Hello I am a new method';

  }

Call in html

<h4>{{siteUrl}}</h4>