本文整理匯總了TypeScript中angular-2-local-storage.LocalStorageService.set方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript LocalStorageService.set方法的具體用法?TypeScript LocalStorageService.set怎麽用?TypeScript LocalStorageService.set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angular-2-local-storage.LocalStorageService
的用法示例。
在下文中一共展示了LocalStorageService.set方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
response => {
var content = response.json().content,
user = content[0];
this.localStorageService.set("userFirstName", user.firstName);
this.localStorageService.set("userSurname", user.surname);
this.localStorageService.set("userId", user._id);
this.localStorageService.set("userRole", user.role);
window.location.href = '//' + window.location.host;
});
示例2:
return this.AuthService.refreshToken(user_name, access_token, refresh_token).map(response => {
if (response) {
this.localStorageService.set("accessToken", response.access_token);
this.localStorageService.set("refreshToken", response.refresh_token);
this.localStorageService.set("expiresTime", (Date.now() / 1000) + response.expires_in);
console.log("refresh token");
this.AuthService.checkRoleForRedirect(/*tempRoute*/);
return true;
} else {
response => {
console.log("Try to Login again");
}
}
})
示例3: setCurrentConnectionProfile
setCurrentConnectionProfile(connectionProfile: string) {
this.localStorageService.set('currentConnectionProfile', connectionProfile);
}
示例4: setItem
setItem(key, value) {
this.storage.set(key, value);
}