Utilizing module constants for configuration data received from the server is a simple and effective approach. You can easily create these constants on the server side:
app.constant('CONFIG', {apiKey: '123456789'});
Then, within your factory, you can make use of these constants by injecting them:
app.factory('apiService', function(CONFIG){
return {
apiKey: CONFIG.apiKey
};
});
Constants are ideal for holding static settings generated on the server side as they remain unchanged once delivered to the client.
Feel free to check out the live demo on jsFiddle: http://jsfiddle.net/example_user/JZcys/1/