Best way to load customer parameters in a multi-tenant angularJS application -
we have multi-tenant angular js single page application. routing application uses customer identifier part of url - #/home/<key>
or #/search/<key>/<search term>
instance. in theory first page served of type. each page calls api using customer key , other values picked url data page. far good.
we have parameters - logo, copyright statement, default language (for internationalization) - can loaded using separate api call uses customer key. these parameters need available strings in partials, drive internationalization , perhaps in controllers.
the question call api these parameters , how set them / make them available rest of app. have looked @ bunch of questions in general area can't find concrete suggestion. should use config in app.js? call script index.html?
appreciate people's advice.
the right place make api call after authentication various customer specific configuration data customer settings logo, language , put them in session storage of browser.
i have done implementation using microsoft adal js per documentation given here. https://github.com/azuread/azure-activedirectory-library-for-js/blob/dev/readme.md.
you can api call in login success event handler or similar ones in angular.
example: $scope.$on("adal:loginsuccess", function () { $scope.testmessage = "loginsuccess"; });
hth
Comments
Post a Comment