Databinding means communication with files.
String Interpolation
Pass data from TS file to html file with {{}} with string interpolation symbol. In this case number easily convert into string.
—-Html file (server.component)
<p>{{ 'Server' }} with ID {{ serverId }} is {{ serverStatus }}</p>
—-Ts file (server.component)
export class ServerComponent{ serverId:number = 10; serverStatus:string = 'offline'; }
Status with function
—-Ts file (server.component)
getServerStatus(){ return this.serverStatus; }
—-Html file (app.component)
<p>{{ 'Server' }} with ID {{ serverId }} is {{ getServerStatus() }}</p>
Everything is still same.