<p>
Server2 is also working fine.
</p>
<button class="btn btn-primary">Add Server</button>
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-server2',
templateUrl: './server2.component.html',
styleUrls: ['./server2.component.css']
})
export class Server2Component implements OnInit {
constructor() { }
ngOnInit() {
}
}
<p>
Server2 is also working fine.
</p>
<button class="btn btn-primary" disabled>Add Server</button>
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;
constructor() {
setTimeout(() =>{
this.allowNewServer = true;
}, 5000);
}
ngOnInit() {
}
}
<p>
Server2 is also working fine.
</p>
<button class="btn btn-primary"
[disabled]="allowNewServer">Add Server</button>
<p>
Server2 is also working fine.
</p>
<button class="btn btn-primary"
[disabled]="!allowNewServer" >Add Server</button>
<p>
Server2 is also working fine.
</p>
<button class="btn btn-primary"
[disabled]="!allowNewServer" >Add Server</button>
<h3>{{allowNewServer}}</h3>
指定字符串插值。
<p>
Server2 is also working fine.
</p>
<button class="btn btn-primary"
[disabled]="!allowNewServer" >Add Server</button>
<h3 [innerText]= "allowNewServer"></h3>