server.component.ts
import {Component, OnInit} from '@angular/core'; @Component({ selector: 'app-server', templateUrl: './server.component.html', styleUrls: ['./server.component.css'] }) export class ServerComponent implements OnInit { public serverCreationStatus: String = 'No server was created'; constructor() { } ngOnInit() { } onCreateServer() { this.serverCreationStatus = 'Server was created'; } }
server.component.html
<button (click)="onCreateServer()">Add Server</button> <p>{{serverCreationStatus}}</p>