angular2
Version:
Angular 2 - a web framework for modern web apps
82 lines • 3.57 kB
JavaScript
;var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var core_1 = require('angular2/core');
var ng_control_1 = require('./ng_control');
var lang_1 = require('angular2/src/facade/lang');
var NgControlStatus = (function () {
function NgControlStatus(cd) {
this._cd = cd;
}
Object.defineProperty(NgControlStatus.prototype, "ngClassUntouched", {
get: function () {
return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false;
},
enumerable: true,
configurable: true
});
Object.defineProperty(NgControlStatus.prototype, "ngClassTouched", {
get: function () {
return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false;
},
enumerable: true,
configurable: true
});
Object.defineProperty(NgControlStatus.prototype, "ngClassPristine", {
get: function () {
return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false;
},
enumerable: true,
configurable: true
});
Object.defineProperty(NgControlStatus.prototype, "ngClassDirty", {
get: function () {
return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false;
},
enumerable: true,
configurable: true
});
Object.defineProperty(NgControlStatus.prototype, "ngClassValid", {
get: function () {
return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false;
},
enumerable: true,
configurable: true
});
Object.defineProperty(NgControlStatus.prototype, "ngClassInvalid", {
get: function () {
return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false;
},
enumerable: true,
configurable: true
});
NgControlStatus = __decorate([
core_1.Directive({
selector: '[ng-control],[ng-model],[ng-form-control]',
host: {
'[class.ng-untouched]': 'ngClassUntouched',
'[class.ng-touched]': 'ngClassTouched',
'[class.ng-pristine]': 'ngClassPristine',
'[class.ng-dirty]': 'ngClassDirty',
'[class.ng-valid]': 'ngClassValid',
'[class.ng-invalid]': 'ngClassInvalid'
}
}),
__param(0, core_1.Self()),
__metadata('design:paramtypes', [ng_control_1.NgControl])
], NgControlStatus);
return NgControlStatus;
})();
exports.NgControlStatus = NgControlStatus;
//# sourceMappingURL=ng_control_status.js.map