Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- adsApp.factory('adsData', ['$http', function($http){
- function getAllAds(){
- $http.get('http://softuni-ads.azurewebsites.net/api/ads')
- .success(function(data) {
- console.log(data);
- return data.ads;
- })
- .error(function() {
- error('Error occurred when get ads');
- }
- );
- };
- function getNumItems(){
- $http.get('http://softuni-ads.azurewebsites.net/api/ads')
- .success(function(data) {
- console.log(data.numItems);
- return data.numItems;
- })
- .error(function() {
- error('Error occurred when get numItems');
- }
- );
- };
- function getNumPages(){
- $http.get('http://softuni-ads.azurewebsites.net/api/ads')
- .success(function(data) {
- console.log(data.numPages);
- return data.numPages;
- })
- .error(function() {
- error('Error occurred when get numPages');
- }
- );
- };
- return {
- getAllAds: getAllAds,
- getNumItems: getNumItems,
- getNumPages: getNumPages
- }
- }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement