Created
March 5, 2015 21:14
-
-
Save octaflop/cb009692de6ba85fcf62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading Events |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Why don’t the success or error functions display? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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