In my AngularJS application I am doing the following
$http.get(\'/plugin/\' + key + \'/js\').success(function (data) {
if (data.length > 0) {
Phew, I was looking for this answer for so long, but it's good it is here. Just to update it, since legacy promise methods success and error have been deprecated and we should use the standard then method instead.
Solution 2 in @geniuscarrier and @jim-horng answers may be rewritten like this:
$http.get('/plugin/' + key + '/js').then(
(function(key) {
return function(data) {
console.log(key, data);
}
})(key),
function(data) {
//error handle
});