cgarnier / angular-mailchimp-subscribe Goto Github PK
View Code? Open in Web Editor NEWAngular mailchimp subscribe module
License: MIT License
Angular mailchimp subscribe module
License: MIT License
The documentation for this module does not state that ng-resource is required. Please include it in documentation/READ.me.
Hi
I want to pick your brain a bit.
In angular api 2.0 they are expecting a structure for email and merge_vars.
Your code amended as follows but the api still returns an error
"status":"error","code":-100,"name":"ValidationError","error":"Validation error: {"email":"Please enter a struct\/associative array","merge_vars":"Please enter a struct\/associative array"}"}
.provider('CgMailChimpService', function () {
var config = { username: '', dc: '', u: '', id: '' };
this.setConfig = function (cfg) {
config = cfg;
};
this.$get = function ($http, $q) {
var url = 'https://' + config.dc + '.api.mailchimp.com/2.0/lists/subscribe';
var params = [];
return {
subscribe: function (data) {
var defer = $q.defer();
var params = angular.extend({}, {
apikey: config.u,
id: config.id,
email: [{
email: data.EMAIL,
euid: '1',
leid: '2'
}],
merge_vars: [{
FNAME: data.FNAME,
LNAME: data.SNAME
}],
email_type: "html",
send_welcome: true
} )
;
$http({
url: url,
params: params,
method: 'JSONP',
}).then(function (data) {
if (data.data.result === 'success')
defer.resolve(data.data);
else
defer.reject(data.data);
}, function (err) {
defer.reject(err)
});
return defer.promise;
}
}
}
});
How secure is this approach to use mailchimp? With API key anybody can do what they want. If they could just add emails that would not be so terrible, but I believe they can also remove existing emails and so on?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.