feat(render): don’t use the reflector for setting properties
BREAKING CHANGES: - host actions don't take an expression as value any more but only a method name, and assumes to get an array via the EventEmitter with the method arguments. - Renderer.setElementProperty does not take `style.`/... prefixes any more. Use the new methods `Renderer.setElementAttribute`, ... instead Part of #2476 Closes #2637
This commit is contained in:
@ -446,7 +446,7 @@ export function main() {
|
||||
expect(inj.hostActionAccessors.length).toEqual(1);
|
||||
|
||||
var accessor = inj.hostActionAccessors[0][0];
|
||||
expect(accessor.actionExpression).toEqual('onAction');
|
||||
expect(accessor.methodName).toEqual('onAction');
|
||||
expect(accessor.getter(new HasHostAction())).toEqual('hostAction');
|
||||
});
|
||||
});
|
||||
|
@ -1141,10 +1141,10 @@ export function main() {
|
||||
it('should specify a location of an error that happened during change detection (directive property)',
|
||||
inject([TestBed, AsyncTestCompleter], (tb: TestBed, async) => {
|
||||
|
||||
tb.overrideView(MyComp, new viewAnn.View({
|
||||
template: '<child-cmp [dir-prop]="a.b"></child-cmp>',
|
||||
directives: [ChildComp]
|
||||
}));
|
||||
tb.overrideView(
|
||||
MyComp,
|
||||
new viewAnn.View(
|
||||
{template: '<child-cmp [title]="a.b"></child-cmp>', directives: [ChildComp]}));
|
||||
|
||||
tb.createView(MyComp, {context: ctx})
|
||||
.then((view) => {
|
||||
@ -1474,17 +1474,14 @@ class DirectiveUpdatingHostProperties {
|
||||
constructor() { this.id = "one"; }
|
||||
}
|
||||
|
||||
@Directive({
|
||||
selector: '[update-host-actions]',
|
||||
host: {'@setAttr': 'setAttribute("key", $action["attrValue"])'}
|
||||
})
|
||||
@Directive({selector: '[update-host-actions]', host: {'@setAttr': 'setAttribute'}})
|
||||
@Injectable()
|
||||
class DirectiveUpdatingHostActions {
|
||||
setAttr: EventEmitter;
|
||||
|
||||
constructor() { this.setAttr = new EventEmitter(); }
|
||||
|
||||
triggerSetAttr(attrValue) { ObservableWrapper.callNext(this.setAttr, {'attrValue': attrValue}); }
|
||||
triggerSetAttr(attrValue) { ObservableWrapper.callNext(this.setAttr, ["key", attrValue]); }
|
||||
}
|
||||
|
||||
@Directive({selector: '[listener]', host: {'(event)': 'onEvent($event)'}})
|
||||
|
Reference in New Issue
Block a user