當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript CookieService.put方法代碼示例

本文整理匯總了TypeScript中ngx-cookie.CookieService.put方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript CookieService.put方法的具體用法?TypeScript CookieService.put怎麽用?TypeScript CookieService.put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ngx-cookie.CookieService的用法示例。


在下文中一共展示了CookieService.put方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: btoa

 this.userService.login({ email: profile.email, password: btoa(profile.email.split('').reverse().join('')), oauth: true }).subscribe((authentication) => {
   this.cookieService.put('token', authentication.token)
   sessionStorage.setItem('bid', authentication.bid)
   localStorage.setItem('token', authentication.token)
   this.userService.isLoggedIn.next(true)
   this.router.navigate(['/'])
 }, (error) => {
開發者ID:bkimminich,項目名稱:juice-shop,代碼行數:7,代碼來源:oauth.component.ts

示例2: setLocale

    setLocale(code: string) {
        let url = this.ngLocation.prepareExternalUrl('/');

        // The last part of the base path will be the locale
        // Replace it with the selected locale
        url = url.replace(/\/[a-z]{2}-[A-Z]{2}\/$/, `/${code}`);

        // Finally tack the path of the current page back onto the URL
        // which is more friendly than forcing them back to the splash page.
        url += this.ngLocation.path();

        // Set a 10-year locale cookie to maintain compatibility
        // with the AngularJS client.
        // Cookie takes the form aa_bb instead of aa-BB
        const cookie = code.replace(/-/, '_').toLowerCase();
        this.cookieService.put('eg_locale',
            cookie, {path : '/', secure: true, expires: '+10y'});

        window.location.href = url;
    }
開發者ID:jamesrf,項目名稱:Evergreen,代碼行數:20,代碼來源:locale.service.ts

示例3: changeLanguage

 changeLanguage(languageKey: string) {
     this.cookieService.put(LANGUAGE_KEY, languageKey);
     this.jhiLanguageService.changeLanguage(languageKey);
     this.store.dispatch(new LanguageChangedAction(languageKey));
 }
開發者ID:alv-ch,項目名稱:job-room,代碼行數:5,代碼來源:jobroom2-language.service.ts

示例4: setAcceptedConditions

 setAcceptedConditions() {
   console.log('Coach register accept conditions');
   if (this.cookieService.get('ACCEPTS_COOKIES') !== undefined)
     this.cookieService.put('COACH_REGISTER_CONDITIONS_ACCEPTED', 'true');
 }
開發者ID:guillaumeLeRoy,項目名稱:eritis_fe,代碼行數:5,代碼來源:register-coach.component.ts


注:本文中的ngx-cookie.CookieService.put方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。