I am working on an AngularJs API for the I18N. I want to ask the backend to know the preference language of the user to know what Locale script file I need to load. The backend sent a json file with the user language preference. This Json file is stocked in a Scope. But to ask the backend with the $http get we need that angularjs is already loaded. So I need to load or change the Locale script file after the user preference is loaded to. I really don't know how to do this without any externals library. Please let me know if you want more details. Thank you :)
Asked
Active
Viewed 39 times
0
-
seems to me you want to dynamically render a – Jony-Y Jul 15 '15 at 21:10
-
1ask backend? Question doesn't make a lot of sense as it is written. Please elaborate on exactly what the problem is – charlietfl Jul 15 '15 at 21:12
-
the statement that you added to the middle of your question body didn't really help to clarify the issue you are having. Lazy loading of scripts is not supported in angular, so without using an external library, what you are trying to do is probably not possible. – Claies Jul 15 '15 at 21:50
-
Sounds like something you need an endpoint for on the back end and either an Angular service or root controller setup to make the request and save the value for the rest of the app. You're overthinking it a bit with the thought that you need to have the value for the angular app. When what you need is to have the value for your frontend controllers. The Angular app use a service to get make the request if the values are not already set to reduce the amount of requests. Thus, it makes the initial request and gets the values it needs. – Hayden Jul 15 '15 at 21:54