Dynamically Setting ngModelOptions in Angular

Viewed 1465

I've got the following snippet:

<input type="date" ng-model="arrival" ng-model-options="{timezone: 'PST'}" />
<input type="time" ng-model="arrival" ng-model-options="{timezone: 'PST'}" />
{{arrival}}

That works properly (the date is displayed in UTC time converted from PST). I'm now trying to make the 'PST' option dynamic:

<select ng-model="timezone>
  <option value="PST">PST</option>
  <option value="EST">EST</option>
</select>
<input type="date" ng-model="arrival" ng-model-options="{timezone: timezone}" />
<input type="time" ng-model="arrival" ng-model-options="{timezone: timezone}" />
{{arrival}}

However, changing the timezone never update the arrival (it appears that binding doesn't work with nd-model-options). Any way I can force the fields to refresh when the timezone is changed?

Edit

Fiddle: https://jsfiddle.net/10nfqow9/

1 Answers
Related