BREAKING CHANGE: Previously, `Directive` was the abstract base class of several directives. Now, `Directive` is the former `Decorator`, and `Component` inherits from it.
14 lines
363 B
JavaScript
14 lines
363 B
JavaScript
import {Directive} from 'angular2/src/core/annotations_impl/annotations';
|
|
|
|
import {Validators} from './validators';
|
|
import {ControlDirective} from './directives';
|
|
|
|
@Directive({
|
|
selector: '[required]'
|
|
})
|
|
export class RequiredValidatorDirective {
|
|
constructor(c:ControlDirective) {
|
|
c.validator = Validators.compose([c.validator, Validators.required]);
|
|
}
|
|
}
|