Files
coriolis/app/js/controllers/controller-link.js

16 lines
458 B
JavaScript
Executable File

angular.module('app').controller('LinkController', ['$scope', 'Utils', '$stateParams', function ($scope, Utils, $stateParams) {
$scope.url = $stateParams.url;
$scope.shortenedUrl = 'Shortening...';
$scope.onTextClick = function ($event) {
$event.target.select();
};
Utils.shortenUrl($scope.url)
.then(function(url) {
$scope.shortenedUrl = url;
},function(e) {
$scope.shortenedUrl = 'Error - ' + e.statusText;
});
}]);