To formulate the question, I prepared a simplified example:
... <input type="date" ng-model="selectedMoment" /> ... <script> angular.module('dateInputExample', []) .controller('DateController', ['$scope', function($scope) { $scope.selectedMoment = moment(); </script>
Basically, I need a binding between the model (date.js date) and the view (input field [date]) for proper operation - the date input is updated when the model is updated, and vice versa. Apparently, trying the example above would result in an error if the model is not of type Date.
This is why I ask experienced AngularJs developers how I can implement this binding correctly?
Any advice appreciated.
javascript angularjs momentjs
ialekseev
source share