fix: flip attr / property bind in directives annotations

Fixes #648

Closes #684
This commit is contained in:
Pawel Kozlowski
2015-02-17 21:55:18 +01:00
parent 709c3ca6b5
commit 56f4e84d45
12 changed files with 36 additions and 36 deletions
+2 -2
View File
@@ -68,7 +68,7 @@ Here is a trivial example of a tooltip decorator. The directive will log a toolt
@Decorator({
selector: '[tooltip]', // CSS Selector which triggers the decorator
bind: { // List which properties need to be bound
tooltip: 'text' // - DOM element tooltip property should be
text: 'tooltip' // - DOM element tooltip property should be
}, // mapped to the directive text property.
event: { // List which events need to be mapped.
mouseover: 'show' // - Invoke the show() method every time
@@ -180,7 +180,7 @@ Viewport is a directive which can control instantiation of child views which are
@Viewport({
selector: '[if]',
bind: {
'if': 'condition'
'condition': 'if'
}
})
export class If {
@@ -196,7 +196,7 @@ export class ElementBinderBuilder extends CompileStep {
var annotation = directive.annotation;
if (isBlank(annotation.bind)) continue;
var _this = this;
StringMapWrapper.forEach(annotation.bind, function (dirProp, elProp) {
StringMapWrapper.forEach(annotation.bind, function (elProp, dirProp) {
var expression = isPresent(compileElement.propertyBindings) ?
MapWrapper.get(compileElement.propertyBindings, elProp) :
null;
+1 -1
View File
@@ -7,7 +7,7 @@ import {ListWrapper} from 'angular2/src/facade/collection';
@Viewport({
selector: '[foreach][in]',
bind: {
'in': 'iterableChanges[]'
'iterableChanges[]': 'in'
}
})
export class Foreach {
+1 -1
View File
@@ -5,7 +5,7 @@ import {isBlank} from 'angular2/src/facade/lang';
@Viewport({
selector: '[if]',
bind: {
'if': 'condition'
'condition': 'if'
}
})
export class If {
+2 -2
View File
@@ -33,7 +33,7 @@ import {Parent} from 'angular2/src/core/annotations/visibility';
@Decorator({
selector: '[switch]',
bind: {
'switch': 'value'
'value': 'switch'
}
})
export class Switch {
@@ -144,7 +144,7 @@ export class Switch {
@Viewport({
selector: '[switch-when]',
bind: {
'switch-when' : 'when'
'when' : 'switch-when'
}
})
export class SwitchWhen {
+4 -4
View File
@@ -99,7 +99,7 @@ export class ControlDirectiveBase {
lifecycle: [onChange],
selector: '[control-name]',
bind: {
'control-name' : 'controlName',
'controlName' : 'control-name',
'type' : 'type'
}
})
@@ -117,7 +117,7 @@ export class ControlNameDirective extends ControlDirectiveBase {
lifecycle: [onChange],
selector: '[control]',
bind: {
'control' : 'controlName',
'controlName' : 'control',
'type' : 'type'
}
})
@@ -134,7 +134,7 @@ export class ControlDirective extends ControlDirectiveBase {
@Decorator({
selector: '[control-group]',
bind: {
'control-group' : 'controlGroup'
'controlGroup' : 'control-group'
}
})
export class ControlGroupDirective extends ControlGroupDirectiveBase {
@@ -163,7 +163,7 @@ export class ControlGroupDirective extends ControlGroupDirectiveBase {
@Component({
selector: '[new-control-group]',
bind: {
'new-control-group' : 'initData'
'initData' : 'new-control-group'
}
})
@Template({inline: '<content>'})
+1 -1
View File
@@ -288,7 +288,7 @@ export function main() {
@Decorator({
selector: '[my-dir]',
bind: {'elprop':'dirProp'}
bind: {'dirProp':'elprop'}
})
class MyDir {
dirProp:string;
@@ -448,7 +448,7 @@ class SomeDecoratorDirective {
}
@Decorator({
bind: {'boundprop1': 'decorProp'}
bind: {'decorProp': 'boundprop1'}
})
class SomeDecoratorDirectiveWithBinding {
decorProp;
@@ -461,8 +461,8 @@ class SomeDecoratorDirectiveWithBinding {
@Decorator({
bind: {
'boundprop1': 'decorProp',
'boundprop2': 'decorProp2'
'decorProp': 'boundprop1',
'decorProp2': 'boundprop2'
}
})
class SomeDecoratorDirectiveWith2Bindings {
@@ -479,7 +479,7 @@ class SomeViewportDirective {
}
@Viewport({
bind: {'boundprop2': 'templProp'}
bind: {'templProp': 'boundprop2'}
})
class SomeViewportDirectiveWithBinding {
templProp;
@@ -492,7 +492,7 @@ class SomeViewportDirectiveWithBinding {
class SomeComponentDirective {
}
@Component({bind: {'boundprop3': 'compProp'}})
@Component({bind: {'compProp': 'boundprop3'}})
class SomeComponentDirectiveWithBinding {
compProp;
constructor() {