I have provider modules that accept configurations such as:
angular.module('app', ['search']). config(['$searchProvider', function($searchProvider) { $searchProvider.options({ resultLimit:50, defaultSort:'highToLow' }); }]);
A new instance of the application will be created for each client - so Iām thinking about using a self-service customer portal to configure the meta object.
This means that now the provider modules must sit inside the callback method to wait for meta before they can set the appropriate configurations.
But let everyone remember: Configuration blocks - are executed during the registration and configuration of the provider. Only suppliers and constants can be entered into configuration blocks. This is to prevent services from being accidentally created before they are fully configured ...
... So, the documents say that you can use the provider in the configuration blocks, but I'm not sure that you can use them to make office calls. Since I have no idea how to do it right, I will show you my "high level" idea:
Terminate dependent providers with another provider callback:
angular.module('app', ['search','meta']). config(['$searchProvider','$metaProvider', function($searchProvider, $metaProvider) { $metaProvider.get(function(meta){ $searchProvider.options(meta); }); }]);
What is the best way to handle this?
javascript angularjs
Dan Kanze Jul 09 '13 at 19:59 on 2013-07-09 19:59
source share