I am new in AngularJS and I have got this problem. I have got defined service `citiesService` with method `addCity`:

```
.service('citiesService', ['$resource', function($resource){
    this.addCity = function(city) {
        var cityItem = $resource("server/?module=cities&action=add", {}, {save: {method: "POST", isArray:true}});

        return cityItem.save({
            city: city
        });
    };
}])

```

It works fine, the new city was successfully added into DB via the PHP script, but I don't know, how to return server response. Server returning response like:

```
$output = [];
$output[] = ["success" => "added to database"];
echo json_encode($output);

```

and then I have got this controller:

```
.controller('citiesAddCtrl', function($scope, $modalInstance, citiesService) {           
    // save addCity form (modal)
    $scope.saveForm = function() {
        if($scope.city.name) {
            $scope.a = citiesService.addCity($scope.city);  
        }
    }
})

```

but I really don't know, how to display server JSON response. When I try something like `console.log($scope.a)`, It shown empty array, but as you can see, the server response is in the right debug menu:

[![](https://i.stack.imgur.com/jLEDv.png)](https://i.stack.imgur.com/jLEDv.png)

Can you help me to solve this problem please? I read some Stackoverflow topics and tried some edits, which are described here, but nothing works for me.