Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Whichever Date i select, datepicker returns todays date. #1169

Closed
safiyu opened this Issue · 8 comments

5 participants

Safiyudeen V S Marcellino van Hecke mini-me Yann Kerhervé Pawel Kozlowski
Safiyudeen V S

ngModel takes the value of todays date no matter whichever date i select. I used the exact way it is shown in the demo. But still such a problem.

Marcellino van Hecke

Can you provide a Plunk? That way we are able to check if it's really an angular-ui issue.

Yann Kerhervé

That works with the following changes (passing selected date as a param to ok()):
http://plnkr.co/edit/WgpiuHLAsJamAyFMyrYN?p=preview

Obviously $scope in ModalCtrl is not what it seems to be. I can't explain why not though, it would be nice if someone more knowledgeable would chime in.

mini-me

It seems that the truth is out there. First method works fine.

Pawel Kozlowski

@mini-me yes, this is pure scoping issue. The modal directive uses transclusion (and thus creates intermediate a child, transclusion scope of a scope seen by a controller) in its directive responsible for window creation:
https://github.com/angular-ui/bootstrap/blob/master/template/modal/window.html

I know that those scoping issues are puzzling but using transclusion is the best I can think of for modal windows in order to avoid code repetition and make those windows felxible.

Closing as duplicate of #969

Safiyudeen V S

I got a simple solution for it. name ngModel something like dt.firstDate or dt.xyz . And initialize scope.dt = {};
Before i was using only dt as ngmodel. for multiple calendars i was using first,second and so on. Now everything Works fine. And thanks guys.

Yann Kerhervé

For those reading @safiyu solution works probably like that:

http://plnkr.co/edit/NXpKApJdZCC5Qm96UrJM?p=preview

Safiyudeen V S

Yeh exactly what I meant. Thanks Yannk. good to go.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.