Created
November 18, 2015 10:37
-
-
Save swallentin/29a1fc4ac676072bafea to your computer and use it in GitHub Desktop.
Alternative
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
(function () { | |
'use strict'; | |
angular.module('topdog', ['ngMaterial', 'topdog.constants']) | |
.config(function($mdIconProvider, $mdThemingProvider) { | |
$mdIconProvider | |
.iconSet('communication', 'img/icons/sets/communication-icons.svg', 24); | |
$mdThemingProvider.theme('default') | |
.primaryPalette('red') | |
.accentPalette('orange'); | |
}) | |
.controller('AppCtrl', function($scope, Profile) { | |
Profile.me().success(function (profile) { | |
$scope.profile = profile; | |
Profile.getPlayerBySteamId(profile.id).success(function(player) { | |
$scope.player = player; | |
}); | |
Profile.getPlayerGamesBySteamId(profile.id).success(function (matches) { | |
$scope.matches = matches; | |
}) | |
}); | |
}); | |
})(); |
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('topdog') | |
.factory('Profile', function ($http, settings, $log) { | |
$log.log(settings); | |
var meApiUrl = [settings.endPoints.base, settings.endPoints.me.path].join(''), | |
playerbySteamIdUrl = [settings.endPoints.base, settings.endPoints.player.base].join(''); | |
return { | |
me: function () { | |
return $http.get(meApiUrl, { withCredentials: true}) | |
}, | |
getPlayerBySteamId: function (steamId) { | |
return $http({ | |
url: playerbySteamIdUrl + steamId, | |
method: 'GET', | |
withCredentials: true | |
}); | |
}, | |
getPlayerGamesBySteamId: function (steamId) { | |
return $http({ | |
url: playerbySteamIdUrl + steamId + settings.endPoints.player.matches, | |
method: 'GET', | |
withCredentials: true | |
}); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment