-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmain.js
More file actions
61 lines (56 loc) · 1.8 KB
/
main.js
File metadata and controls
61 lines (56 loc) · 1.8 KB
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
'use strict';
requirejs.config({
shim: {
'angular': { exports: 'angular' },
'angularBootstrap': { deps: ['angular'] },
'angularEncodeUri': { deps: ['angular'] },
'angularHighlightJS': { deps: ['angular', 'highlightJS'] },
'jsyaml': { exports: 'jsyaml' },
'underscore': { exports: '_' }
},
paths: {
angular: 'components/angular/angular.min',
angularBootstrap: 'components/angular-bootstrap/ui-bootstrap-tpls.min',
angularEncodeUri: 'components/angular-encode-uri/dist/angular-encode-uri.min',
angularHighlightJS: 'components/angular-highlightjs/angular-highlightjs.min',
domReady: 'components/requirejs-domready/domReady',
highlightJS: 'components/highlightjs/highlight.pack',
jsyml: 'components/js-yaml/js-yaml',
underscore: 'components/underscore/underscore'
}
});
require(
[
'angular',
'jsyml',
'underscore',
'angularBootstrap',
'angularHighlightJS',
'domReady!'
],
function (ng, jsyml, _) {
ng.module('app', ['hljs', 'ui.bootstrap']).
controller('RamlViewCtrl', function($scope, $http, $anchorScroll, $location) {
$http.get('bountysource.raml?cache=' + (new Date()).getTime()).then(function (response) {
$scope.api = jsyml.load(response.data);
$scope.traits = _.extend.apply({}, $scope.api.traits);
$scope.httpMethods = ['get', 'post', 'put', 'delete', 'head', 'info'];
});
$scope.scrollTo = function(hash) {
$location.hash(hash);
$anchorScroll(hash);
};
})
.directive('parameters', function () {
return {
restrict: 'EAC',
scope: {
params: '=',
title: '='
},
templateUrl: 'templates/parameters.html'
};
});
ng.bootstrap(document, ['app']);
}
);