`layerMetadata()` returns already a promise `$q.all`, you can get rid of the promises array and just use a promise variable.
```
var promise;
promise = layerMetadata();
promise.then(function() {...});
```

But maybe I miss something.