Skip to content

Instantly share code, notes, and snippets.

@octaflop
Created March 5, 2015 21:14
Show Gist options
  • Save octaflop/cb009692de6ba85fcf62 to your computer and use it in GitHub Desktop.
Save octaflop/cb009692de6ba85fcf62 to your computer and use it in GitHub Desktop.
angular.module('BasicModule', [])
.config(['$httpProvider', function($httpProvider) {
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
}
])
.controller('BasicCtrl', function BasicCtrl($http){
var basic = this;
basic.events_api_url = "https://gdata.youtube.com/feeds/api/videos/?v=2&alt=json";
basic.loadEvents = function loadEvents() {
console.log("Loading Events");
$http.get(basic.events_api_url)
.then(function success(data){
console.log("Success! Result: ");
console.log(data);
}, function error(err){
console.log("ERROR" + err);
});
};
basic.loadEvents();
});
Why don’t the success or error functions display?
<div id="basic" ng-app='BasicModule'>
<div class='tester' ng-controller="BasicCtrl as basic">
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment