Controller to use a service -->Angular

app.controller('HostController', function ($scope, $rootScope, Host){ $scope.makeConnection = function(url){ $scope.connecting = true; Host.doConnect(url) .then( function (status){ $scope.connecting = false; if (status) { $rootScope.$broadcast('connected'); $scope.hideDialog('addip-dialog'); $scope.errorMsg = null; } else { $scope.showDialog('addip-dialog'); $scope.errorMsg = "Error al conectar con el servidor"; } }); };

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.