本文整理汇总了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);
}
}
示例2: constructor
constructor(private companyService: CompanyService, private _cookie: CookieService) {
this.companyId = this._cookie.get('companyId');
}
示例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;
}
示例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);
}
示例5: ngOnInit
ngOnInit() {
this.consumerId = this._cookie.get('consumerId');
this.checkLikedStatus(this.consumerId);
}
示例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();
});
}
示例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;
});
}
示例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});
},
示例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});
},
示例10: isViewedByConsumer
isViewedByConsumer() {
return this._cookie.get('consumer_token');
}