Angular services for validating JSON. Uses tv4 under the hood, so is only able to work with JSON Schema v4.
- Includes an HTTP Interceptor service that can validate request and response data
- Recursively loads
$ref
schemas (ie, schemas that are referenced inside other schemas) - Supports precompilation of schemas into an Angular cache to avoid HTTP calls
-
Install with bower:
bower install angular-json-validator
Or manually download
angular-json-validator.js
andtv4.js
ortv4.min.js
. -
Include the JS files in your project.
angular-json-validator.js
should be loaded afterangular.js
. -
If you want to use the HTTP Interceptor, add
bt.jsonValidator
as a dependency of your application module. For example:angular.module('myApp', ['bt.jsonValidator', ...]) { ... });
If you just want to use the
JsonValidator
service, includebt.jsonValidator
as a dependency of whatever module is using it. For example:angular.module('myModule', ['bt.jsonValidator', ...]) { ... });