// Generated by CoffeeScript 1.12.7
/**
* Input age for volume search filter
* @module
*/
'use strict';
app.directive('inputAge', [
'constantService', 'displayService', function(constants, display) {
return {
restrict: 'E',
templateUrl: 'site/inputAge.html',
require: 'ngModel',
scope: {},
link: {
pre: function($scope, $element, $attrs, ctrl) {
var AGE;
AGE = constants.age;
ctrl.$render = function() {
var u;
u = AGE[$scope.unit = display.ageMode(ctrl.$viewValue)];
$scope.value = parseFloat((ctrl.$viewValue / u).toFixed(Math.ceil(Math.log10(u))));
};
$scope.changeValue = function(event) {
ctrl.$setViewValue(Math.round($scope.value * AGE[$scope.unit]), event);
};
$scope.changeUnit = function() {
display.toggleAge($scope.unit);
};
$scope.$on('displayService-toggleAge', ctrl.$render);
}
}
};
}
]);
//# sourceMappingURL=inputAge.js.map