angular2
Version:
Angular 2 - a web framework for modern web apps
21 lines (20 loc) • 944 B
JavaScript
import { isPresent } from 'angular2/src/facade/lang';
import { unimplemented } from 'angular2/src/facade/exceptions';
/**
* Base class for control directives.
*
* Only used internally in the forms module.
*/
export class AbstractControlDirective {
get control() { return unimplemented(); }
get value() { return isPresent(this.control) ? this.control.value : null; }
get valid() { return isPresent(this.control) ? this.control.valid : null; }
get errors() {
return isPresent(this.control) ? this.control.errors : null;
}
get pristine() { return isPresent(this.control) ? this.control.pristine : null; }
get dirty() { return isPresent(this.control) ? this.control.dirty : null; }
get touched() { return isPresent(this.control) ? this.control.touched : null; }
get untouched() { return isPresent(this.control) ? this.control.untouched : null; }
get path() { return null; }
}