Skip to main content

angular - Display value using interpolation

app.component.ts

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})

export class AppComponent {
  name: String = "Jenny";
  age: Number = 30;
  jobTitle: String = "Software developer";
  hoby: String = "Gardening";
}
app.component.html

<h2>
    Hello, I am {{name}}!
    I am a {{jobTitle}}.
    My hobby is {{hoby}} and
    I am {{age}} years old.
</h2>
More Angular tutorials