bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

timepicker: ng-model not undated when set directly without wrapping DIV

Open vitalets opened this issue 13 years ago • 3 comments

When ng-modelset directly in <timepicker>:

<timepicker ng-model="mytime" ng-change="changed()" hour-step="hstep" minute-step="mstep" show-meridian="ismeridian"></timepicker>

ng-model not updated when clicking on hours/minutes

vitalets avatar Oct 08 '13 16:10 vitalets

@vitalets yeh, this is one of those AngularJS scoping oddities that you will have to learn with. Basically in AngularJS each DOM element can be associated with one scope only. Since the <timepicker> directive is creating an isolated scope the ngModel directives is evaluated in the context of this isolated scope. This is what is described in the issue opened for AngularJS: https://github.com/angular/angular.js/issues/1924

The easy workaround is to prefix ngModel expression with $parent:

<timepicker ng-model="$parent.mytime"></timepicker>

I understand that it might be confusing but unfortunately this is not something we can address in this project - it needs to be solved on the AngularJS level, but it is a complex problem so I wouldn't expect it to change overnight.

pkozlowski-opensource avatar Oct 08 '13 17:10 pkozlowski-opensource

I am using timepicker angular ui component in my form, After 1 st form submit, when I am submitting 2 nd form it is blank, it only take value if I manually change timepicker.

ShindePrasad avatar Jun 26 '15 08:06 ShindePrasad

I am facing an issue with timepicker. Form is not resetting when i click on reset button. But the model is setting to null. data is not clearing off from the form.

<timepicker readonly-input="true" ng-model="issue.closeByTime" show-meridian="false"></timepicker> In controller $scope.issue.closeByTime = null;

On UI, HH and MM are still showing although model is null. Can you please help me

Srishailam avatar Mar 29 '17 20:03 Srishailam