Реализовываю работу с воркером через сервисы ('ng-vkThread','ngWebworker'), в данном примере - 'ngWebworker', но ошибку получаю одну и тужу:
ReferenceError: $http is not defined
Помогите, в с чем связана проблема?
app.js
var app = angular.module('contactList', ['lumx','ngSanitize', 'ngCsv', 'ng-vkThread','ngWebworker']);
app.controller('ReadFileController', ['$scope','$http','vkThread','Webworker', function ($scope, $http, vkThread, Webworker) {
var foo = function (content) {
$http.post('/anguler-tasks-contacts/addContactData.php',{last_name:1, name:2, patronymic_name:3, address:4, telephone:5, url:6, description:7, completed:'false'}).then(function(response) {
$scope.contactslist.push({
id: response.data[0].id,
last_name: response.data[0].last_name,
name: response.data[0].name,
patronymic_name: response.data[0].patronymic_name,
address: response.data[0].address,
telephone: response.data[0].telephone,
url: response.data[0].url,
description: response.data[0].description,
completed: response.data[0].completed
});
});
return 1;
}
$scope.readContent = function($fileContent){
$scope.content = $fileContent;
var myWorker2 = Webworker.create(foo);
myWorker2.run($scope.content).then(function(result) {
console.log(result);
});
};
}]);