I am an absolute beginner with Angular 2 and I have the following doubt relate property binding.
This example works but I have doubt about what exactly happen under the hood.
I have a component view (the servers.component.html file) containing this button:
<button [disabled]="!allowNewServer" class="btn btn-primary">Add Server</button>
The related component is:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-servers',
templateUrl: './servers.component.html',
styleUrls: ['./servers.component.css']
})
export class ServersComponent implements OnInit {
allowNewServer = false;
constructor() {
setTimeout(() => {
this.allowNewServer = true;
}, 8000);
}
ngOnInit() {
}
}
As you can see at the beginning the allowNewServer value is false, after 8 seconds it is setted to true by a function declared in the constructor.
On my button is setted this disabled attribute:
[disabled]="!allowNewServer"
So at the beginning the button is disabled and after 8 seconds it will enabled.
Mu doubts are:
1) What exactly means the [...] Angular syntax?
2) I expected that was rendered something like disabled=true (at the beginning) and after 8 seconds something like disabled=dalse, but after 8 seconds simply the disable attribute is deleted. So I think that I am not understending what the [...] syntax mean.