feat(Directive): Have a single Directive.host which mimics HTML
fixes #2268 BREAKING CHANGE: Before @Directive({ hostListeners: {'event': 'statement'}, hostProperties: {'expression': 'hostProp'}, hostAttributes: {'attr': 'value'}, hostActions: {'action': 'statement'} }) After @Directive({ host: { '(event)': 'statement', '[hostProp]': 'expression' // k & v swapped 'attr': 'value', '@action': 'statement' } })
This commit is contained in:

committed by
Tobias Bosch

parent
47b6b05017
commit
f3b49378e4
@ -293,21 +293,14 @@ export class DirectiveBinding extends ResolvedBinding {
|
||||
var resolvedViewInjectables = ann instanceof Component && isPresent(ann.viewInjector) ?
|
||||
resolveBindings(ann.viewInjector) :
|
||||
[];
|
||||
var metadata = new DirectiveMetadata({
|
||||
var metadata = DirectiveMetadata.create({
|
||||
id: stringify(rb.key.token),
|
||||
type: ann instanceof
|
||||
Component ? DirectiveMetadata.COMPONENT_TYPE : DirectiveMetadata.DIRECTIVE_TYPE,
|
||||
selector: ann.selector,
|
||||
compileChildren: ann.compileChildren,
|
||||
events: ann.events,
|
||||
hostListeners:
|
||||
isPresent(ann.hostListeners) ? MapWrapper.createFromStringMap(ann.hostListeners) : null,
|
||||
hostProperties:
|
||||
isPresent(ann.hostProperties) ? MapWrapper.createFromStringMap(ann.hostProperties) : null,
|
||||
hostAttributes:
|
||||
isPresent(ann.hostAttributes) ? MapWrapper.createFromStringMap(ann.hostAttributes) : null,
|
||||
hostActions: isPresent(ann.hostActions) ? MapWrapper.createFromStringMap(ann.hostActions) :
|
||||
null,
|
||||
host: isPresent(ann.host) ? MapWrapper.createFromStringMap(ann.host) : null,
|
||||
properties: ann.properties,
|
||||
readAttributes: DirectiveBinding._readAttributes(deps),
|
||||
|
||||
|
Reference in New Issue
Block a user