So I have an angular application and I've created a hybrid android application using PhoneGap. But currently, I have one issue -
In the angular code, there are many places in the service
and controller
files where API calls are made. Now, the path of the server from where the API call is made needs to be configurable i.e making a change to a variable in a single file should reflect the change in all angular files. I'm have an idea of using a variable that could be used like - Say the variable is configurableVar
; then the variable could be used as such - http://$rootScope.configurableVar/api/call
(I'm not sure whether a rootScope
variable could be used with PhoneGap)
Currently the API call is as such - http://serverpath:port/api/call
but this serverpath is hard-coded in each controller and service files.
Also, could the config.xml file be used in this case? If yes, then how could I use the variable created in the config.xml in the angular files?