Skip to content

Latest commit

 

History

History
38 lines (24 loc) · 1.4 KB

README.md

File metadata and controls

38 lines (24 loc) · 1.4 KB

angular-json-validator

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

Installation

  1. Install with bower:

     bower install angular-json-validator
    

    Or manually download angular-json-validator.js and tv4.js or tv4.min.js.

  2. Include the JS files in your project. angular-json-validator.js should be loaded after angular.js.

  3. 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, include bt.jsonValidator as a dependency of whatever module is using it. For example:

     angular.module('myModule', ['bt.jsonValidator', ...]) {
       ...
     });