当前位置: 首页>>代码示例>>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;未经允许,请勿转载。