@Component({ selector: 'app-server2', templateUrl: './server2.component.html', styleUrls: ['./server2.component.css'] }) export class Server2Component implements OnInit { allowNewServer = false; serverCreationStatus= 'No Server is created.'; constructor() { setTimeout(() =>{ this.allowNewServer = true; }, 5000); } ngOnInit() { } }
<p> Server2 is also working fine. </p> <button class="btn btn-primary" [disabled]="!allowNewServer" >Add Server</button> <!--<h3 [innerText]= "allowNewServer"></h3>--> {{serverCreationStatus}}
<p> Server2 is also working fine. </p> <button class="btn btn-primary" [disabled]="!allowNewServer" (click)="onCreateServer()">Add Server</button> <!--<h3 [innerText]= "allowNewServer"></h3>--> {{serverCreationStatus}}
<label>Server Name</label> <input type="text" class="form-control" (input)="OnUpdateServerName($event)"> <p>{{serverName}}</p>
import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-server2', templateUrl: './server2.component.html', styleUrls: ['./server2.component.css'] }) export class Server2Component implements OnInit { allowNewServer = false; serverName = ''; constructor() { setTimeout(() =>{ this.allowNewServer = true; }, 5000); } ngOnInit() { } OnUpdateServerName(event: Event) { this.serverName = (<HTMLInputElement>event.target).value; } }