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


TypeScript CookieService.put方法代碼示例

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


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

示例1: onSaveResponse

 onSaveResponse(result: any, error: any) {
     if (error != null) {
         console.log(error);
         return;
     }
     this.user = result;
     this._cookieService.put("username", this.user.Username);
     this._cookieService.put("password", this.user.Password);
 }
開發者ID:Gaiidenn,項目名稱:gowa-frontend.old,代碼行數:9,代碼來源:user.service.ts

示例2: loginResponse

 loginResponse(result: any, error: any) {
     if (error != null) {
         console.log(error);
         return;
     }
     console.log(JSON.stringify(result));
     this.user = result;
     this._cookieService.put("username", this.user.Username);
     this._cookieService.put("password", this.user.Password);
     console.log(this.user);
     console.log(this.isUserRegistered());
 }
開發者ID:Gaiidenn,項目名稱:gowa-frontend.old,代碼行數:12,代碼來源:user.service.ts

示例3: calculateScore

    calculateScore(score, axis) {
        let netScore;
        let savedScore = this.cookieService.get("score");
        //set score to default if it does not exist, and calculate from there
        if (!savedScore) {
            savedScore = ("0.5,0.5,0.5");
        }
        let dividedScore = savedScore.split(",");
        //cookie values are in alphabetical order; savory, spice, sweet
        //if an unexpected axis name appears, the score will simply remain the same
        if(axis === "savory") {
            netScore = Number(dividedScore[0]) + score;
            dividedScore[0] = this.checkScoreBoundary(netScore);
        } else if (axis === "spice") {
            netScore = Number(dividedScore[1]) + score;
            dividedScore[1] = this.checkScoreBoundary(netScore);
        } else if (axis === "sweet") {
            netScore = Number(dividedScore[2]) + score;
            dividedScore[2] = this.checkScoreBoundary(netScore);
        }

        let newScore = "";
        dividedScore.forEach(function(entry, index) {
           newScore = newScore + entry;
            if(index != 2) {
                newScore = newScore + ',';
            }
        });
        this.cookieService.put("score", newScore);
    }
開發者ID:dylan-mcdonald,項目名稱:nmpalate,代碼行數:30,代碼來源:question.ts

示例4: gotoDashboard

    gotoDashboard(result) {
        if (result) {
            this.cookieService.put('loginCookie', 'true');

            this.router.navigateByUrl('/dashboard');
        } else {
            this.showError('Incorrect email and/or password.');
        }
    }
開發者ID:dankostiuk,項目名稱:caterme_fullstack_project,代碼行數:9,代碼來源:login.component.ts

示例5: put

    put(key, value) {

        if (key !== this.cacheKeys.Card) {
            try {
                this._cookieService.put(key, value);
                this._localStorage.set(key, value);
                this.cache[key] = value;
            } catch (e) {
                console.error('cache error!', e);
            }
        }
    };
開發者ID:busidex-vinbrown,項目名稱:orgadmin,代碼行數:12,代碼來源:cache.service.ts

示例6: saveToken

 public saveToken(value: Token) {
     console.log('Token wird gespeichert: ' + JSON.stringify(value));
     this._cookieService.put(this.tokenstorekey, JSON.stringify(value));
     this._navibarService.hasToken(true);
 }
開發者ID:CodeMax,項目名稱:Scalable-Shopsystem,代碼行數:5,代碼來源:token.service.ts

示例7: initializeCookie

 initializeCookie() {
     //cookie values are in alphabetical order: savory, spicy, sweet
     this.cookieService.put("score", "0.5,0.5,0.5");
 }
開發者ID:dylan-mcdonald,項目名稱:nmpalate,代碼行數:4,代碼來源:question.ts

示例8: logout

 logout(): void {
     this.user = this.initUser();
     this._cookieService.put("username", null);
     this._cookieService.put("password", null);
 }
開發者ID:Gaiidenn,項目名稱:gowa-frontend.old,代碼行數:5,代碼來源:user.service.ts

示例9: put

 private put(key:ConfigKeys, valor:string) {
   this._cookieService.put(ConfigKeys[key], valor, {expires: TEN_YEARS_FROM_NOW});
 }
開發者ID:acdcjunior,項目名稱:prp-client,代碼行數:3,代碼來源:config.service.ts


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