scratch – Blame information for rev 133
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
75 | office | 1 | # angular-yamljs |
2 | |||
3 | This is an angular wrapper for [YAMLJS](https://github.com/jeremyfa/yaml.js) written by [Jeremy Faivre](https://github.com/jeremyfa) |
||
4 | |||
5 | |||
6 | How to Install |
||
7 | ---------- |
||
8 | |||
9 | ``` bash |
||
10 | bower install angular-yamljs |
||
11 | ``` |
||
12 | |||
13 | How to use |
||
14 | ---------- |
||
15 | Add dependency to angular application |
||
16 | |||
17 | ``` js |
||
18 | angular.module('app', ['mmumshad.yamljs']); |
||
19 | ``` |
||
20 | |||
21 | Use it in code |
||
22 | |||
23 | ``` js |
||
24 | angular.module('app') |
||
25 | .controller('Ctrl1', function (YAML) { |
||
26 | // parse YAML string |
||
27 | nativeObject = YAML.parse(yamlString); |
||
28 | |||
29 | // Generate YAML |
||
30 | yamlString = YAML.stringify(nativeObject, 4); |
||
31 | |||
32 | // Load yaml file using YAML.load |
||
33 | nativeObject = YAML.load('myfile.yml'); |
||
34 | }); |
||
35 | ``` |