I have written method called getChildren
to get data related to id, but I am unable to access that data in caller method. My sample code is as follows
I have written these two methods in controller and Passed all objects which are necessary
var baseMethod = function(rootNode) {
var id = 123;
var result = getChildren(id);
};
var getChildren = function(id) {
var deferred = $q.defer();
return dummyService.oneAction(id).then(
function (data) {
return deferred.resolve(data);
}
);
}
Whats wrong with this. I want to assign data in callback to my result. How can I do that.