Skip to content

Instantly share code, notes, and snippets.

@LarsBergqvist
Last active January 11, 2016 04:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LarsBergqvist/abbb29da55f489a21be0 to your computer and use it in GitHub Desktop.
Save LarsBergqvist/abbb29da55f489a21be0 to your computer and use it in GitHub Desktop.
An AngularJS controller for fetching all channel info from the Swedish Radio open API
var myApp = angular.module('myApp', []);
myApp.controller('SRChannelsController', ['$scope', '$http', function($scope, $http) {
var promise = $http.get("http://api.sr.se/api/v2/channels/?format=json&pagination=false&filter=channel.channeltype&filtervalue=Riks");
promise.then(function(response) {
var channels = response.data.channels;
$scope.channels = channels;
});
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment