Why are Angular 2 or Angular 4 using parentheses for bananas? Is there any specific reason for this? Why won't they follow the same pattern as Angular 1?

I know this is not related to any encoding, but they can follow the same syntax as in Angular 1

<input ng-model="hero.name" placeholder="name" type="text">

AngulAR 2 and its larger syntax are still

 <input [(ngModel)]="hero.name" placeholder="name" type="text">

If they do, would it be very helpful if people adapt the changes in Angular JS?

Similarly for ng-repeat they changed to ngFor

<ul ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn">
  <li>...</li>
</ul>
<ul ng-repeat="item in items track by myTrackingFunction(n)">
<li>...</li>
</ul>
+4
source share
2 answers

Banana braces are for double binding.

Cm.

Binding Syntax:

- , , . HTML, , . HTML .

Angular . , Angular .

, : , view-to-source : --.

+3

... [()], angular. . [] setter while () getter, ngModel.

Setters [] , .


Angular (2,4+) 1, angular typescript typescript. typescript JavaScript + . , .

angularjs, , , angularjs angular.

+1

Source: https://habr.com/ru/post/1675602/


All Articles