Reputation: 828
I am using angular 6, In Prime NG Module they have parameters like [(visible)]="displayAddDialog", I want to understand what is the menaing of "[(". I know that if we want to bind input we use [], for output we use (). But i am not aware of [()]. Please help me to understand, If possible give me an example
Upvotes: 0
Views: 814
Reputation: 7819
Basically the "[()]" means both. The best example is when you use a ngModel.
As mentioned in the doc :
<app-sizer [(size)]="fontSizePx"></app-sizer>
is equivalent to :
<app-sizer [size]="fontSizePx" (sizeChange)="fontSizePx=$event"></app-sizer>
Upvotes: 6
Reputation: 36
This mean two binding in angular 2+ version
[(target)]="expression"
Binding types other than interpolation have a target name to the left of the equal sign, either surrounded by punctuation ([], ()) or preceded by a prefix (bind-, on-, bindon-).
The target name is the name of a property. It may look like the name of an attribute but it never is. To appreciate the difference, you must develop a new way to think about template HTML.
<input type=text [(ngModel)]="user.name" [value]="user.id"/>
Upvotes: 0