我想在我的pre-bootstrapping angular.injector中配置ngstorage的前缀。
angular.element(document).ready(function () {
var
initInjector = angular.injector(['ng', 'ngStorage']),
$http = initInjector.get('$http'),
$localStorage = initInjector.get('$localStorage'),
$localStorageProvider = initInjector.get('$localStorageProvider'),
storage = $localStorage.$default({
configuration: {},
configurationExpireDate: new Date()
})
;
// initInjector.config(function () { $localStorageProvider.setKeyPrefix('CT'); }); // not working
$localStorageProvider.setKeyPrefix('CT'); // not working, too
}
所以,也许您知道如何在以编程方式引导“真实”应用之前配置ngstorage前缀。
谢谢!
答案 0 :(得分:0)
例如,如果,
var myApp = angular.module(' myApp',[]);
您可以使用myApp.run(function(){
//你的代码在这里。它将在bootstrapping之前执行
});