This repository has been archived on 2022-01-02. You can view files and clone it, but cannot push or open issues or pull requests.
AriaNg/app/scripts/controllers/new.js

29 lines
916 B
JavaScript
Raw Normal View History

2016-06-18 18:11:19 +02:00
(function () {
'use strict';
angular.module('ariaNg').controller('NewTaskController', ['$rootScope', '$scope', '$location', 'ariaNgCommonService', 'aria2TaskService', function ($rootScope, $scope, $location, ariaNgCommonService, aria2TaskService) {
$scope.urls = '';
$scope.options = {};
$scope.startDownload = function () {
var urls = $scope.urls.split('\n');
var tasks = [];
for (var i = 0; i < urls.length; i++) {
tasks.push({
urls: [urls[i].trim()],
options: $scope.options
});
}
$rootScope.loadPromise = aria2TaskService.newUriTasks(tasks, function (response) {
if (!response.hasSuccess) {
return;
}
$location.path('/downloading');
});
};
}]);
})();