How to configure factory externally in AngularJS

Say I am building a C# application with AngularJS.

I want to set up configuration object that comes from server side and basically inject that configuration into a factory. Where the factory resides in another .JS file.

How would go about doing that?

I have a JS fiddle example set up here:

http://jsfiddle.net/f89tS/7/

You could use module's constants for configuration objects coming from the server. Using constants is pretty easy, you could generate this on the server-side:

app.constant('CONSTANTS', {zoomLevel: 8});

and then, in your factory you can inject constants:

app.factory('map', function(CONSTANTS){
    return {
        zoomLevel: CONSTANTS.zoomLevel  
    };
});

Constants are really good for the server-generated settings since, once generated and sent to the client those can't change.

Finally, here is the working jsFiddle: http://jsfiddle.net/pkozlowski_opensource/JZcys/1/

Here is an example of how I accomplished something similar by wrapping my bootstrap call around my own run method.

It then uses a naming convention to inject configuration options inline from your aspx page, which could be set via c# property.

I don't know if this is the 'angular' way, but it has worked well thus far.

http://jsfiddle.net/xpressivecode/dVM9b/