{"action":"closed","issue":{"url":"https://api.github.com/repos/angular-ui/bootstrap/issues/3188","labels_url":"https://api.github.com/repos/angular-ui/bootstrap/issues/3188/labels{/name}","comments_url":"https://api.github.com/repos/angular-ui/bootstrap/issues/3188/comments","events_url":"https://api.github.com/repos/angular-ui/bootstrap/issues/3188/events","html_url":"https://github.com/angular-ui/bootstrap/issues/3188","id":54351593,"number":3188,"title":"datepicker-popup: Cannot change minDate option on the fly","user":{"login":"mike-bresnahan","id":6494117,"avatar_url":"https://avatars.githubusercontent.com/u/6494117?v=3","gravatar_id":"","url":"https://api.github.com/users/mike-bresnahan","html_url":"https://github.com/mike-bresnahan","followers_url":"https://api.github.com/users/mike-bresnahan/followers","following_url":"https://api.github.com/users/mike-bresnahan/following{/other_user}","gists_url":"https://api.github.com/users/mike-bresnahan/gists{/gist_id}","starred_url":"https://api.github.com/users/mike-bresnahan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mike-bresnahan/subscriptions","organizations_url":"https://api.github.com/users/mike-bresnahan/orgs","repos_url":"https://api.github.com/users/mike-bresnahan/repos","events_url":"https://api.github.com/users/mike-bresnahan/events{/privacy}","received_events_url":"https://api.github.com/users/mike-bresnahan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular-ui/bootstrap/labels/component:%20datepicker","name":"component: datepicker","color":"ffffff"},{"url":"https://api.github.com/repos/angular-ui/bootstrap/labels/needs:%20investigation","name":"needs: investigation","color":"eb6420"},{"url":"https://api.github.com/repos/angular-ui/bootstrap/labels/type:%20bug","name":"type: bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"antoinepairet","id":5238592,"avatar_url":"https://avatars.githubusercontent.com/u/5238592?v=3","gravatar_id":"","url":"https://api.github.com/users/antoinepairet","html_url":"https://github.com/antoinepairet","followers_url":"https://api.github.com/users/antoinepairet/followers","following_url":"https://api.github.com/users/antoinepairet/following{/other_user}","gists_url":"https://api.github.com/users/antoinepairet/gists{/gist_id}","starred_url":"https://api.github.com/users/antoinepairet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antoinepairet/subscriptions","organizations_url":"https://api.github.com/users/antoinepairet/orgs","repos_url":"https://api.github.com/users/antoinepairet/repos","events_url":"https://api.github.com/users/antoinepairet/events{/privacy}","received_events_url":"https://api.github.com/users/antoinepairet/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/angular-ui/bootstrap/milestones/9","html_url":"https://github.com/angular-ui/bootstrap/milestones/1.0.0","labels_url":"https://api.github.com/repos/angular-ui/bootstrap/milestones/9/labels","id":528366,"number":9,"title":"1.0.0","description":"Rewrite in ES6","creator":{"login":"chrisirhc","id":132584,"avatar_url":"https://avatars.githubusercontent.com/u/132584?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisirhc","html_url":"https://github.com/chrisirhc","followers_url":"https://api.github.com/users/chrisirhc/followers","following_url":"https://api.github.com/users/chrisirhc/following{/other_user}","gists_url":"https://api.github.com/users/chrisirhc/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisirhc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisirhc/subscriptions","organizations_url":"https://api.github.com/users/chrisirhc/orgs","repos_url":"https://api.github.com/users/chrisirhc/repos","events_url":"https://api.github.com/users/chrisirhc/events{/privacy}","received_events_url":"https://api.github.com/users/chrisirhc/received_events","type":"User","site_admin":false},"open_issues":38,"closed_issues":128,"state":"open","created_at":"2014-01-07T00:22:46Z","updated_at":"2015-11-07T15:30:27Z","due_on":null,"closed_at":null},"comments":9,"created_at":"2015-01-14T17:35:18Z","updated_at":"2015-11-07T15:30:27Z","closed_at":"2015-11-07T15:30:27Z","body":"I have 2 datepicker-popup's that define a date range. There is a constraint that the second date must be greater than or equal to the first date. When the user changes the first one, I would like to set the minDate option of the second one. I have attempted to do this like this:\r\n\r\n\t$scope.endDateOptions = {\r\n\t\tminDate: 'BeginDate'\r\n\t};\r\n\r\nHowever, the expression 'BeginDate\" does not resolve to anything because the context of the $watch in DatepickerController is an isolated scope. Here is the relevant source code from ui-bootstrap.tpls.js:\r\n\r\n\t// Watchable date attributes\r\n\tangular.forEach(['minDate', 'maxDate'], function( key ) {\r\n\t    if ( $attrs[key] ) {\r\n\t\t$scope.$parent.$watch($parse($attrs[key]), function(value) {\r\n\t\t    self[key] = value ? new Date(value) : null;\r\n\t\t    self.refreshView();\r\n\t\t});\r\n\t    } else {\r\n\t\tself[key] = datepickerConfig[key] ? new Date(datepickerConfig[key]) : null;\r\n\t    }\r\n\t});\r\n\r\nI don't understand what the above $watch is supposed to accomplish. In what use case would I want to watch for a change in the isolated scope of datepicker-popup? Shouldn't the $watch context be the parent of the datepicker-popup so that it can see changes in 'BeginDate'?"}}