0.0.3 • Published 5 years ago

ng-jsyaml v0.0.3

Weekly downloads
101
License
MIT
Repository
-
Last release
5 years ago

ng-jsyaml

AngularJS wrapper for js-yaml package

This is just a package which allows using js-yaml in the AngularJS way.

Installation

NPM

npm install --save ng-jsyaml

Yarn

yarn add ng-jsyaml

Bower

bower install --save ng-jsyaml

Usage

  1. Add js-yaml and ng-jsyaml js files into your html file
...
<script src="path/to/js-yaml/dist/js-yaml.js"></script>
<script src="path/to/ng-jsyaml/angular-jsyaml.js"></script>
...
  1. Add dependency to AngularJS module
angular.module('your-app', ['ng-jsyaml']);
  1. Inject yaml service and voila!
angular.module('your-app')
  .controller('YourController', YourController)
  
YourController.$inject = ['yaml']

function YourController(yaml) {
  // your awesome code
  
  // use yaml here
  
  // more of your awesome code
}

API

parse (string , options)

Alias of safeLoad of js-yaml

stringify (object , options)

Alias of safeDump of js-yaml

License

MIT