My directive is:
我的指示是:
window.map.directive('dosingFrequencies', [
function() {
return {
restrict: 'E',
scope: true,
templateUrl: '/views/directives/dosingFrequencies.html',
controller: function($scope, util) {
console.log('here we go!');
angular.extend($scope, {
model: createModel(),
addFrequency: function(med) {
med.frequencies.push(createFreqModel());
},
removeFrequency: function(med, index) {
med.frequencies.splice(index, 1);
},
showTimeChecked: function(freq) {
if (freq.showTime) {
freq.prn = false;
freq.quantity = '';
freq.quantityWhole = '';
freq.quantityFrac = '';
resetTimeToFirstLast(freq, this.model.facilityTimezone)
}
if (!freq.showTime) {
for (var z = 0; z < freq.doses.length; z++) {
freq.doses[z].quantity = '';
freq.doses[z].quantityWhole = '';
freq.doses[z].quantityFrac = '';
}
resetTimeToAllday(freq, this.model.facilityTimezone);
}
},
updateDosingForm: function(med) {
med.template.dosingForm = doseUnitChoices[med.med.dosingUnit] || ['', ''];
}
});
}
};
}
]);
window.map.directiv