Property and Attribute Binding in Angular || Displaying Data and Handling Events
In this video,I explained property and attribute binding in Angular. Feel free to comment. For more, please subscribe and press the BELL icon. Please visit my Angular Playlist. Please visit my YouTube Videos. The code is as follows -
data.component.ts -
import { Component } from '@angular/core';
@Component ({
selector: 'data',
template: `
<h4> Property Binding </h4>
<img src= " {{ ImgLink }}" /> <br/> <br/>
<h4> Attribute Binding </h4>
<table [attr.border]="BorDer">
<tr> <td [attr.colspan]="ColSpan"> Hello </td>
<td> Hi </td>
</tr>
</table>
`
})
export class DataComponent {
ImgLink = "assets/img/angular.png";
ColSpan = 2;
BorDer = 14;
}
data.component.ts -
import { Component } from '@angular/core';
@Component ({
selector: 'data',
template: `
<h4> Property Binding </h4>
<img src= " {{ ImgLink }}" /> <br/> <br/>
<h4> Attribute Binding </h4>
<table [attr.border]="BorDer">
<tr> <td [attr.colspan]="ColSpan"> Hello </td>
<td> Hi </td>
</tr>
</table>
`
})
export class DataComponent {
ImgLink = "assets/img/angular.png";
ColSpan = 2;
BorDer = 14;
}
Comments
Post a Comment