Dear friends,

I have been learning to get around AngularJS in order to marry the data got 
from a MongDB (through PHP) to an OpenLayers 3 instance.

The main issue I have is that I do not know how to pass the data of a 
.success not only to the $scope, but also to a variable. This variable 
loaded in fact with a GeoJSON object (served by the PHP), will populate a 
vector layer of the OpenLayer's vector.

The problem is that I don't know how to pass the data to a variable.

THE FACTORY

(function(){

    var factGetFeat = function($http){    //folosesti serviciul angular 
$http
        
        var asyncData = {};
        
        asyncData.getWholeData = function(){
            return $http.get('./resources/allres.php');
        };

        return asyncData;
        
    };
    
    factGetFeat.$inject = ['$http'];

    angular.module('render')
           .factory('factGetFeat', factGetFeat);
}());

THE CONTROLLER

    var Mapper = function($scope, factGetFeat){

        $scope.allRO = {};

        factGetFeat.getWholeData() 
            .success(      
                function(data){
                    $scope.allRO = data;
//                    console.log(data);

                }
            )
            .error(
                function(data, status, headers, config){

                }
            );

// And here at the object I should need a variable loaded with my object

        var vectorSource = new ol.source.GeoJSON({
            object: theNeededVariable
        });

Thank you for your kind help.

-- 
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 angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to