forked from Gaduo/FHIRSampleCreator
-
Notifications
You must be signed in to change notification settings - Fork 3
/
codeMirror.html
65 lines (55 loc) · 2.03 KB
/
codeMirror.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
<!DOCTYPE html>
<html>
<head>
<title>CodeMirror with AngularJS</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/>
<script src="js/libs/angular.min1-5.js"></script>
<script src="js/libs/ui-bootstrap-tpls-2.0.1.min.js"></script>
<link href="/Content/codemirror-3.01/codemirror.css" rel="stylesheet"/>
<link href="/Content/codemirror-3.01/theme/rubyblue.css" rel="stylesheet"/>
<script src="/Scripts/codemirror-3.01/codemirror.js" type="text/javascript"></script>
<script src="/Scripts/codemirror-3.01/mode/javascript.js" type="text/javascript"></script>
<script type="text/javascript">
var myApp = angular.module('myApp', ['ui', 'ui.bootstrap']);
myApp.value('ui.config',
{
codemirror:
{
mode: 'javascript',
lineNumbers: true,
matchBrackets: true,
theme: 'rubyblue'
}
});
function codeCtrl($scope,$http)
{
$scope.docLocation = document.location.href;
$http.get($scope.docLocation)
.success(function (data)
{
$scope.code = data;
});
//$scope.code = "var a = 'somecode'; \n//which also shows above</h1>";
}
</script>
</head>
<body ng-app="myApp">
<div class="well well-large">
<div class="container">
<h2>CodeMirror working with AngularJS and Bootstrap</h2></div>
</div>
<div ng-controller="codeCtrl">
<div class="container">
<h4>Code Editor:</h4>
<p>With the the contents of this page (i.e.: {{docLocation}} )</p>
<textarea ui-codemirror ng-model="code"></textarea>
<br/><hr/><br/>
<h4>Bootstrap alert style</h4>
<p>
Showing in real time the contents of the code shown above (make a change to try it)
</p>
<alert type="success">{{code}}</alert>
</div>
</div>
</body>
</html>