To declare a string and use it in the component html file follow these steps. In this example, we are declaring the value of title.

  1. Declare the new value of title in app.component.ts inside the export class AppComponent { as such:
    export class AppComponent {
      title = 'Title at app.compoents.ts';
  2. Now you can use it string variable in the app.component.html file like this:

Thats it.