-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
92 lines (85 loc) · 3.55 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Document</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/8.6.1/jsoneditor.min.css" rel="stylesheet">
<link href="https://getbootstrap.com/docs/4.0/examples/sticky-footer-navbar/sticky-footer-navbar.css" rel="stylesheet">
<style>
html, body{ height:100% }
</style>
</head>
<body ng-app="plunker" ng-controller="MainCtrl">
<div class="row" style="height:100%">
<div dynamic="obj" class="col-md-6"></div>
<div class="col-md-6" style="height:100%">
<angular-jsoneditor ng-model="obj" options="options" style="width: 100%; height: 400px;"></angular-jsoneditor><button class="btn" ng-click="changeOptions()">Change View</button>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" ></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" ></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" ></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/angular-jsoneditor.js"></script>
<script src="https://minasvisual.github.io/ng-json-to-html/ngJsonHtml.js" type="text/javascript">
</script>
<script>
var app = angular.module('plunker', ['ng-json-html', 'angular-jsoneditor']);
app.controller('MainCtrl', function($scope) {
$scope.name = 'World';
$scope.options = {mode: 'tree'};
$scope.obj = {
"header": {
"nav|.[navbar navbar-expand-md navbar-dark bg-dark]": {
"a|@[#]|.[navbar-brand]": "Brand",
"button|.[navbar-toggler]|data-toggle=collapse|data-target=#navbarCollapse|type=button": {
"span|.[navbar-toggler-icon]": ""
},
"div|.[collapse navbar-collapse]|#[navbarCollapse]":{
"ul|.[navbar-nav]": [
{"li|.[nav-item]|ng-repeat='val in arr'": {"a|.[nav-link]": "{{ val.name }}"} }
]
}
}
},
"main|.[container]": {
"h1|.[mt-5]": "Sticky footer with fixed navbar",
"p|.[lead]": "description text bla bla bla",
"p|#[1]": {
"a|@[#]": "Sticky footer link"
}
},
"footer|.[footer]": {
"div|.[container]": {
"span|.[text-muted]": "Place sticky footer"
}
}
};
$scope.arr = [
{"id": 1, "name": "Ulisses"},
{"id": 2, "name": "Marcos"},
{"id": 3, "name": "Alexandre"},
];
$scope.changeOptions = function () {
$scope.options.mode = $scope.options.mode == 'tree' ? 'code' : 'tree';
};
$scope.onLoad = function (instance) {
instance.expandAll();
this.options.mode = 'code';
this.options.completer = [
{value: "$sameer", score: 1000, meta: "custom"},
{value: "$rathore", score: 1000, meta: "custom"}
];
};
$scope.changeData = function () {
$scope.obj.data = {foo: 'bar'};
};
$scope.changeOptions = function () {
$scope.obj.options.mode = $scope.obj.options.mode == 'tree' ? 'code' : 'tree';
};
$scope.pretty = function (obj) {
return obj;
};
})
</script>
</body>
</html>