In template:
<form role="form" ng-submit="submitQuery()">
<div class="form-group">
<label for="latestInput">ending time</label>
<input type="datetime-local" id="latestInput" name="latestInput"
ng-model="latest" placeholder="yyyy-MM-ddTHH:mm" required />
<input type="submit" id="submit" value="Submit">
</div>
</form>
In controller:
var now = new Date();
$scope.latest = new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes());
I'd like to have the latestInput set up to display time when user launched the page, it works in the documentation example
but not in my code, nor in this plunker:
http://plnkr.co/edit/d91CZS88OsmJMt6oyo9p?p=preview
what's wrong with this?
Note: I had angular telling me
Octal literals are not allowed in strict mode.
when I tried to use new Date(2014, 29, 7, 10, 38);
this is why I'm using now