I'm having a bit of trouble using $http using the AngularJS framework. I've read several of the other posts about this error but I can't work out what I'm doing wrong. Any help would be greatly appreciated. The error is 'Uncaught ReferenceError: $http is not defined' and the code is:
function removePupil(val) {
var string = 'Jon:jon@aaa.com:George:george@aaa.co.uk:Matthew:matthew@aaa.com:';
var pupilNowRemoved = string.replace(val, '');
var data = {
"customer[id]": {{ customer.id }},
"metafield[customer.pupils]": pupilNowRemoved,
};
$http.post('/a/custmeta', $.param(data),
{"headers" : {"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"}
}).success(function(data, status, headers, config) {
console.log('Removed pupil')
}). error(function(data, status, headers, config) {
console.log('Did not remove pupil')
});
}