In my AngularJS application I am doing the following
$http.get(\'/plugin/\' + key + \'/js\').success(function (data) {
if (data.length > 0) {
Instead of polluting scope or complicating with iif, another cleaner way is to create a callback function and call it with parameters;
var myCallBack = function (key) {
return function (data) {
if (data.length > 0) {
console.log(data, key);
}
}
}
$http.get('/plugin/' + key + '/js').success(myCallBack(key));