merlin/extensions/hotbuilder/static/hotbuilder/js/hotbuilder.controllers.js

47 lines
884 B
JavaScript

(function() {
'use strict';
angular
.module('hotbuilder')
.controller('HotbuilderController', HotbuilderController);
HotbuilderController.$inject = ['$q', '$http'];
function HotbuilderController($q, $http) {
var deferred = $q.defer();
var vm = this;
deferred.promise.then(function(url) {
$http.get(url).success(function(data) {
data.forEach(function(resourceType) {
$http.get(url + '/' + resourceType).success(function(data) {
vm.allEntries.push(data);
});
});
});
});
vm.setUrl = setUrl;
vm.allEntries = [];
vm.entries = [
];
vm.panel = {
title: 'Add Resource'
};
vm.tabs = [
{title: 'Parameters', content: 'There'},
{title: 'Outputs', content: 'Where'}
];
function setUrl(url) {
deferred.resolve(url);
}
}
})();