I'm trying to create a duration editor which could represent "x days x hours x minutes x seconds" for a number which stores total seconds.
So the model totalSeconds is a number, and I create object duration of class Duration in the directive, then use 4 editable-text for those 4 properties.
In link method of the directive, I create scope.duration model and watch the object duration, the callback recalculates and updates the binding model totalSeconds.
When saving,
duration.days gets called first
- form's onaftersave gets called
- $watch callback for
duration (or duration.days) gets called
So I'm not able to save the updated totalSeconds in step 2.
Is there a way to let step 3 done before step 2?
I'm trying to create a duration editor which could represent "x days x hours x minutes x seconds" for a number which stores total seconds.
So the model
totalSecondsis a number, and I create objectdurationof class Duration in the directive, then use 4 editable-text for those 4 properties.In link method of the directive, I create
scope.durationmodel and watch the objectduration, the callback recalculates and updates the binding modeltotalSeconds.When saving,
duration.daysgets called firstduration(orduration.days) gets calledSo I'm not able to save the updated
totalSecondsin step 2.Is there a way to let step 3 done before step 2?