I am just starting to learn Angularjs so i might be using the whole thing wrong but please correct me.

I have the following factory that goes like this:

```
app.factory('MenuService',['service1','service2','service3',function(service1,service2,service3){

    var var1 = [],
        var2 = [],
        var3 = [];

    service1.getDataMethod(function(data){
        // processes data and saves it in var1
    });

    service2.getDataMethod2(function(data)){

    });

    /// same goes for service3.

    return {"prop2": var1, "prop2" : var2, "prop3": var3};
}])

```

I need to process the data return by service2 , based on data returned in the first service but every time i try to access it, the variable is empty. 

I know the functions return a promise, is there a way to tell the second function to wait for the first one to finish in order to be able to use the data it brings?

I hope i made myself understood. Let me know if i should add something else.