jsonp call raw gist in angular
errors because response is being eval'd
by James Doyle
HTML
<div ng-app>
<div ng-controller="mainCtrl">
<p>Both these are raw gists. one is a js based gist the other is bash/shell.</p>
<button ng-click="makeRequest(0)">make request 1</button>
<button ng-click="makeRequest(1)">make request 2</button>
</div>
</div>
JavaScript
var rawurl = ["https://gist.github.com/raw/4673583/975479b279617ae7e17740cfbf6ce3339d9af066/Reset%20Chosen%20list", "https://gist.github.com/raw/4665900/212f1bfd1a8f725d66987fff104b59ef17e46714/find%20replace%20bash%20function"];
function mainCtrl($scope, $http) {
function jsonp_callback(data) {
console.log(data);
}
$scope.makeRequest = function (num) {
$http({
url: rawurl[num] + "?callback=jsonp_callback",
method: "JSONP"
});
}
}