本文整理匯總了TypeScript中angular-2-local-storage.LocalStorageService.clearAll方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript LocalStorageService.clearAll方法的具體用法?TypeScript LocalStorageService.clearAll怎麽用?TypeScript LocalStorageService.clearAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angular-2-local-storage.LocalStorageService
的用法示例。
在下文中一共展示了LocalStorageService.clearAll方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: Error
.then(() => {
if (this.localStorageService.clearAll()) {
this.zone.runOutsideAngular(() => {
location.reload();
});
} else {
throw new Error('Failed to clear local storage');
}
});
示例2: clearLocalStorage
public clearLocalStorage() {
indexedDB.deleteDatabase('_pouch_Composer');
if (this.localStorageService.clearAll()) {
this.zone.runOutsideAngular(() => {
location.reload();
});
} else {
throw new Error('Failed to clear local storage');
}
}
示例3: clearLocalStorage
public clearLocalStorage(): Promise<boolean> {
if (this.localStorageService.clearAll()) {
return this.router.navigateByUrl('/')
.then((result) => {
if (result) {
window.open('/', '_self');
}
return result;
});
} else {
throw new Error('Failed to clear local storage');
}
}
示例4: logout
logout(access_token: string, refresh_token: string): Observable<any> {
let dataObj = {
Access: access_token,
Refresh: refresh_token
}
const url = this._config.apiAuthURL + "api/v1/ManagementTokens/ClearTokens";
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
this.sub = this.http.post(url, dataObj, options).catch(this.handleError);
// clear token remove user from local storage to log user out
this.localStorageService.clearAll();
return this.sub;
}