mardi 3 mars 2015

AngularJS, how do I combine multiple inputs into a single ng-model? Specifically, to combine a date, time, and timezone input into a datetime object


I need to create a datetime object to store in MySQL, but I need it to be entered with multiple inputs (one for date, one for time, one for timezone). So right now my code is like this:



<input type="datetime-local", ng-model="workshop_date">


But what I want is something more like this:



<input type="date", ng-model="date">
<input type="time", ng-model="time">
<select ng-model="zone">
<option>Pacific</option>
<option>Eastern</option>

<input value='{{date + time + zone}}', ng-model="workshop_date", style="display:none">


However, this solution seems to confuse Angular. Is there any way I can take multiple inputs and make that the value of the ng-model?





Aucun commentaire:

Enregistrer un commentaire