angular-date-interceptor
v1.0.2
Published
An AngularJS interceptor to parse dates from server response
Downloads
5
Readme
angular-date-interceptor
An AngularJS interceptor to parse dates from server response.
The problem
By default, if you want to bind a model (which comes from the server) to a date input, you will get Error: [ngModel:datefmt] Expected 2015-07-25T11:40:35.395Z to be a date
.
The problem is that the date is in ISO 8061 string format and it is not a date object. This interceptor convert dates into date objects.
Installation
You can choose your preferred method of installation:
- Through npm:
npm install angular-date-interceptor --save
- Download from github: unminified version or minified version
Usage
Include angular-date-interceptor.js in your application.
<script src="components/angular-date-interceptor/dist/angular-date-interceptor.js"></script>
Add the module angularDateInterceptor
as a dependency to your module:
angular.module('myApp', ['angularDateInterceptor']);
License
Released under the terms of the MIT License.