okuznetsov1,
$scope.content = 'blabla';
var workerPromise1 = WorkerService.createAngularWorker(['input', 'output',
function(input, output) {
function parseCSV(input){
/* body parseCSV */
return parseInput
}
output.notify(parseCSV(input));
}]);
var workerPromise2 = WorkerService.createAngularWorker(['input', 'output', '$http',
function(input, output, $http) {
angular.forEach(input, function (value, key) {
$http.post('http://www.xxx.com/anguler-tasks-contacts/addContactData.php',{last_name:value[1], name:value[2], patronymic_name:value[3], address:value[4], telephone:value[5], url:value[6], description:value[7], completed:'false'})
.then(function(response){
output.notify(response.data[0]);
});
});
}]);
workerPromise1.then(function success(angularWorker) {
//The input must be serializable
return angularWorker.run($scope.content);
}, function error(reason) {
//for some reason the worker failed to initialize
//not all browsers support the HTML5 tech that is required, see below.
}).then(function success(result) {
//handle result
}, function error(reason) {
//handle error
}, function notify(Items) {
workerPromise2.then(function(angularWorker){
return angularWorker.run(Items)
}).then(
function(){},
function(){},
function notify(response){console.log(response)}
)
});