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
@ -10,8 +10,8 @@ import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async';
|
||||
@Directive({
|
||||
selector: 'md-input-container',
|
||||
lifecycle: [onAllChangesDone],
|
||||
hostProperties:
|
||||
{'inputHasValue': 'class.md-input-has-value', 'inputHasFocus': 'class.md-input-focused'}
|
||||
host:
|
||||
{'[class.md-input-has-value]': 'inputHasValue', '[class.md-input-focused]': 'inputHasFocus'}
|
||||
})
|
||||
export class MdInputContainer {
|
||||
// The MdInput or MdTextarea inside of this container.
|
||||
@ -57,9 +57,12 @@ export class MdInputContainer {
|
||||
@Directive({
|
||||
selector: 'md-input-container input',
|
||||
events: ['mdChange', 'mdFocusChange'],
|
||||
hostProperties: {'yes': 'class.md-input'},
|
||||
hostListeners:
|
||||
{'input': 'updateValue($event)', 'focus': 'setHasFocus(true)', 'blur': 'setHasFocus(false)'}
|
||||
host: {
|
||||
'[class.md-input]': 'yes',
|
||||
'(input)': 'updateValue($event)',
|
||||
'(focus)': 'setHasFocus(true)',
|
||||
'(blur)': 'setHasFocus(false)'
|
||||
}
|
||||
})
|
||||
export class MdInput {
|
||||
value: string;
|
||||
|
Reference in New Issue
Block a user