Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

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

Closed
vitalets opened this issue Oct 8, 2013 · 3 comments
Closed

Comments

@vitalets
Copy link

vitalets commented Oct 8, 2013

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

@pkozlowski-opensource
Copy link
Member

@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: angular/angular.js#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.

@ShindePrasad
Copy link

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.

@Srishailam
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants