————————
app = angular.module('angularWebApp.indexController', []);
app.controller('indexController', function($scope, $http, $rootScope, $sce, $timeout, $modal) {
$scope.controllsubmit = function() {
//console.log("I was called!");
};
if ($scope.user !== undefined) {
angular.forEach($scope.user.software_key, function(software_key, key) {
//$scope.theKeys = $scope.user.software_key;
//var software_key = '';
//console.log('result: ' + result);
$rootScope.software_key = software_key;
//alert($scope.software_key);
$http.get('http://54.213.13.56/api/' + software_key + '/remotes').
success(function(data) {
if (data.id === 'error') {
console.log(data);
} else {
$scope.machineList = data;
//$rootScope.key = software_key;
//console.log($scope.user.software_key[1]);
//console.log($scope.key);
$scope.testing = 'http://54.213.13.56/settings';
$scope.testingUrl = $sce.trustAsResourceUrl($scope.testing);
//Wait until the current $digest is done and then run the form submit to update the iframe
$timeout(function() {
//console.log('I made it');
var frm = angular.element('#myForm');
frm.submit();
});
}
}).
error(function(data) {
alert(data);
});
});
}
});