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


TypeScript cookies.service.CookieService類代碼示例

本文整理匯總了TypeScript中angular2-cookie/services/cookies.service.CookieService的典型用法代碼示例。如果您正苦於以下問題:TypeScript service.CookieService類的具體用法?TypeScript service.CookieService怎麽用?TypeScript service.CookieService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: constructor

 constructor(private translate: TranslateService, private cookie: CookieService, private balanceService: BalanceService) {
     this.translate.setDefaultLang('en');
     const language = this.cookie.get('language');
     if (language) {
         this.translate.use(language);
     }
 }
開發者ID:theirc,項目名稱:balance.refugee.info,代碼行數:7,代碼來源:app.component.ts

示例2: constructor

 constructor(private companyService: CompanyService, private _cookie: CookieService) {
   this.companyId = this._cookie.get('companyId');
 }
開發者ID:IgorFilippov3,項目名稱:complaints-book,代碼行數:3,代碼來源:company.component.ts

示例3: checkViewState

 checkViewState(item, other) {
   const itemId = this._cookie.get(item + 'Id');
   const otherId = this._cookie.get(other + 'Id');
   if(itemId) {
     return true;
   }
   else {    
     if(!otherId) return true;
   }
   return false;
 }
開發者ID:IgorFilippov3,項目名稱:complaints-book,代碼行數:11,代碼來源:home.component.ts

示例4: submitAnswer

  submitAnswer(answer) {
    let body = new FormData();
    body.append('answer', answer);
    body.append('csrfmiddlewaretoken', this.cookieService.get('csrftoken'));

    return this.makePOSTAPICall('/kryptos/submitanswer', body);
  }
開發者ID:Augustinetharakan12,項目名稱:excel-play-2017,代碼行數:7,代碼來源:kryptos.service.ts

示例5: ngOnInit

  ngOnInit() {
    this.consumerId = this._cookie.get('consumerId');
    this.checkLikedStatus(this.consumerId);

    
        
  }
開發者ID:IgorFilippov3,項目名稱:complaints-book,代碼行數:7,代碼來源:message-card.component.ts

示例6: onSubmitMessageForm

  onSubmitMessageForm() {
    const message = this.messageForm.value.message;
    const consumer = this._cookie.get('consumer_token');
    this.messageService.addMessage(message, consumer, this.cardId)
        .subscribe((data) => {
          const { content, id, author, likes } = data.obj;
          const new_message = new Message(content, this.card.name, id, this.card.id, 0, [], []);
          this.card.messages.push(new_message);
          this.messageForm.reset();
        });

  }
開發者ID:IgorFilippov3,項目名稱:complaints-book,代碼行數:12,代碼來源:company-card.component.ts

示例7: makePOSTAPICall

 public makePOSTAPICall(url, data) {
   data.append('csrfmiddlewaretoken', this.cookieService.get('csrftoken'));
   var loader = new ProgressiveLoader();
   loader.placeLoader('Auth_ss');
   var headers: Headers = new Headers();
   headers.append('Content-Type', 'text/plain; charset=UTF-8');
   return this.http.post(ApiRoot()+url, (data), { withCredentials: true })
     .map(res => {
       loader.removeLoader();
       var x = res.json();
       if (x.error)
         this.router.navigate(['/signin']);
       return x;
     });
 }
開發者ID:Augustinetharakan12,項目名稱:excel-play-2017,代碼行數:15,代碼來源:service.ts

示例8:

 data => {
   this._cookie.put('company_token', data.token);
   this._cookie.put('companyId', data.companyId);
   this.companyService.handleCompanyId(data.companyId);
   this.router.navigate(['/company/card', data.companyId], {relativeTo: this.activatedRoute});
 },
開發者ID:IgorFilippov3,項目名稱:complaints-book,代碼行數:6,代碼來源:signin.component.ts

示例9:

 data => {
   this._cookie.put('consumer_token', data.token);
   this._cookie.put('consumerId', data.consumerId);
   this.consumerService.handleConsumerId(data.consumerId);
   this.router.navigate(['/consumer/signup'], {relativeTo: this.activatedRoute});
 },
開發者ID:IgorFilippov3,項目名稱:complaints-book,代碼行數:6,代碼來源:signin.component.ts

示例10: isViewedByConsumer

 isViewedByConsumer() {
   return this._cookie.get('consumer_token');
 }
開發者ID:IgorFilippov3,項目名稱:complaints-book,代碼行數:3,代碼來源:company-card.component.ts


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