import {Component} from '@angular/core'; @Component( {selector: 'app-server', templateUrl: 'server.component.html'}) export class ServerComponent { serverID: number = 10; serverStatus: string = 'Online'; }
<p>Server with ID {{serverID}} is {{serverStatus}}. </p>
import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: ` <h1>{{ fullName }}</h1> ` }) export class AppComponent { fullName: string = 'Robert Junior'; }
import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: ` <h1 [innerHtml]='fullName'></h1> ` }) export class AppComponent { fullName: string = 'Robert Junior'; }
@Component({ selector: 'my-app', template: `<div> <h1>{{citedExample}}</h1> </div>` }) export class AppComponent { citedExample: string = 'Interpolation foe string only'; }
import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: `<div> <button [disabled]='isDisabled'>Disable me</button> </div>` }) export class AppComponent { isDisabled: boolean = true; }
import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: `<div> <button disabled='{{isDisabled}}'>Disable Me</button> </div>` }) export class AppComponent { isDisabled: boolean = true/false; }