feat(core): desugar [()] to [prop] and (prop-change)

BREAKING CHANGE

Before

```
<cmp [(prop)]="field"> was desugared to <cmp [prop]="field" (prop)="field=$event">
```

After
```
<cmp [(prop)]="field"> is desugared to <cmp [prop]="field" (prop-change)="field=$event">
```

Closes #4658
This commit is contained in:
vsavkin
2015-10-10 19:56:22 -07:00
committed by Victor Savkin
parent df09389df8
commit 7c6130c2c5
9 changed files with 33 additions and 21 deletions

View File

@ -361,7 +361,8 @@ class TemplateParseVisitor implements HtmlAstVisitor {
private _parseAssignmentEvent(name: string, expression: string, sourceInfo: string,
targetMatchableAttrs: string[][], targetEvents: BoundEventAst[]) {
this._parseEvent(name, `${expression}=$event`, sourceInfo, targetMatchableAttrs, targetEvents);
this._parseEvent(`${name}-change`, `${expression}=$event`, sourceInfo, targetMatchableAttrs,
targetEvents);
}
private _parseEvent(name: string, expression: string, sourceInfo: string,

View File

@ -75,7 +75,7 @@ const controlNameBinding =
selector: '[ng-control]',
bindings: [controlNameBinding],
inputs: ['name: ngControl', 'model: ngModel'],
outputs: ['update: ngModel'],
outputs: ['update: ngModelChange'],
exportAs: 'form'
})
export class NgControlName extends NgControl implements OnChanges,

View File

@ -66,7 +66,7 @@ const formControlBinding =
selector: '[ng-form-control]',
bindings: [formControlBinding],
inputs: ['form: ngFormControl', 'model: ngModel'],
outputs: ['update: ngModel'],
outputs: ['update: ngModelChange'],
exportAs: 'form'
})
export class NgFormControl extends NgControl implements OnChanges {

View File

@ -37,7 +37,7 @@ const formControlBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRe
selector: '[ng-model]:not([ng-control]):not([ng-form-control])',
bindings: [formControlBinding],
inputs: ['model: ngModel'],
outputs: ['update: ngModel'],
outputs: ['update: ngModelChange'],
exportAs: 'form'
})
export class NgModel extends NgControl implements OnChanges {