// Generated by CoffeeScript 1.12.7
/**
* Expose (or create a new dummy) form control to scope
* @module
*/
'use strict';
app.directive('formCtrl', [
'$parse', function($parse) {
return {
restrict: 'A',
require: ['^form', '?ngModel'],
link: function($scope, $element, $attrs, $ctrls) {
var ctrl;
ctrl = $ctrls[1];
if (!ctrl) {
ctrl = {
$untouched: true,
$touched: false,
$pristine: true,
$dirty: false,
$valid: true,
$invalid: false,
$setPristine: function() {
var ref;
this.$dirty = false;
this.$pristine = true;
if ((ref = this.$$parentForm.subformControl) != null) {
ref.$setPristine();
}
},
$setDirty: function() {
this.$dirty = true;
this.$pristine = false;
this.$$parentForm.$setDirty();
},
$setUntouched: function() {
this.$touched = false;
this.$untouched = true;
},
$setTouched: function() {
this.$untouched = false;
this.$touched = true;
}
};
$ctrls[0].$addControl(ctrl);
}
$parse($attrs.formCtrl).assign($scope, ctrl);
}
};
}
]);
//# sourceMappingURL=formCtrl.js.map