import {
Directive,
LifecycleEvent,
Attribute,
Host,
SkipSelf,
AfterContentChecked
} from 'angular2/angular2';
import {ObservableWrapper, EventEmitter} from 'angular2/src/core/facade/async';
// TODO(jelbourn): validation (will depend on Forms API).
// TODO(jelbourn): textarea resizing
// TODO(jelbourn): max-length counter
// TODO(jelbourn): placeholder property
@Directive({
selector: 'md-input-container',
host: {
'[class.md-input-has-value]': 'inputHasValue',
'[class.md-input-focused]': 'inputHasFocus',
}
})
export class MdInputContainer implements AfterContentChecked {
// The MdInput or MdTextarea inside of this container.
_input: MdInput;
// Whether the input inside of this container has a non-empty value.
inputHasValue: boolean;
// Whether the input inside of this container has focus.
inputHasFocus: boolean;
constructor(@Attribute('id') id: string) {
this._input = null;
this.inputHasValue = false;
this.inputHasFocus = false;
}
afterContentChecked() {
// Enforce that this directive actually contains a text input.
if (this._input == null) {
throw 'No or