I am trying to create a solution that would have services that can be 
refreshed at a user will. For example on a button click.
Here is my controller:
motoAdsApp.controller('AirportControllers', function($scope, $http, 
AirportService) {
    var now = new Date();
    var date = new Date(now.setDate(now.getDate()-2));
    $scope.eventDetailReportDateFrom = getFormattedDate(date);
var now = new Date();
    $scope.eventDetailReportDateTo = getFormattedDate(now);
   AirportService.getData($scope.eventDetailReportDateFrom, 
$scope.eventDetailReportDateTo).then(function(data) {
var json = $.xml2json(data);
  $scope.airports = json.airportsSummary;
    });  
    }   
});

and Service
var myModule = angular.module('motoAdsApp', ["wijmo"]);
myModule.factory("AirportService", function ($http, $q) {
    return {
        getData : function(dateFrom, dateTo){
            var deferred = $q.defer();

            var response = 
$http.get("http://localhost:7070/AlarmSummaryArchive?parameters=dateFrom + 
"|" + dateTo);
            response.success(function (data) {
                deferred.resolve(data);
            });
            response.error(function (data) {
                alert('Error');
            });
            // Return the promise to the controller
            return deferred.promise;
        }
    }
});

A user can select dates and refresh data. How can I make my solution 
accomplishing that?

Thanks 

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to