I am trying to return data through a JSONP call from my angular application. I tried this workaround: angular $resource with jsonp not working. All I did was replacing it for my webapi link and suddenly the callback 'blaat' is not triggered? fiddle:http://jsfiddle.net/QC4Wk/5/ This is a fragment of the code:
$http({
method: "JSONP",
params: {
callback: "blaat"
},
url: "http://localhost:7234/api/person",
isArray: true
})
My ApiController looks like:
public class PersonController : ApiController
{
public List<Person> Get()
{
Person person1 = new Person() { name = "mark", id = 1 };
Person person2 = new Person() { name = "ed", id = 2 };
Person person3 = new Person() { name = "fred", id = 3 };
List<Person> lijst = new List<Person>();
lijst.Add(person1);
lijst.Add(person2);
lijst.Add(person3);
return lijst;
}
}
How can I wrap the callback on the serverside properly so I can use this in the angularrequest?