本文整理汇总了TypeScript中angular2-cookie/core.CookieService类的典型用法代码示例。如果您正苦于以下问题:TypeScript CookieService类的具体用法?TypeScript CookieService怎么用?TypeScript CookieService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CookieService类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: beforeEach
beforeEach(() => {
machineIdConfig = 'valid-cookie';
thisMachineConfig = Observable.of(MachineConfiguration.fromJson({'MachineId': '123'}));
cookieService = new CookieService(new CookieOptions());
cookieService.putObject('machine_config_id', '1991653a-ddb8-47fd-9d3a-86761506fa4f');
cookieService.putObject('machine_config_details', { 'KioskConfigId': 1, 'KioskIdentifier': '1991653a-ddb8-47fd-9d3a-86761506fa4f', 'KioskName': 'Test Kiosk 1 Name', 'KioskDescription': 'Test Kiosk 1 Desc', 'KioskTypeId': 1, 'LocationId': 3, 'CongregationId': 1, 'RoomId': 1984, 'StartDate': '2016-10-27T00:00:00', 'EndDate': null });
fixture = new HomeComponent(router, cookieService, setupServiceStub);
childSigninRedirectSpy = spyOn(fixture, 'goToChildSignin');
childCheckinRedirectSpy = spyOn(fixture, 'goToChildCheckin');
adminToolsRedirectSpy = spyOn(fixture, 'goToAdminTools');
setupErrorRedirectSpy = spyOn(fixture, 'goToSetupError');
});
开发者ID:crdschurch,项目名称:crds-signin-checkin,代码行数:12,代码来源:home.component.spec.ts
示例2: beforeEach
beforeEach(() => {
cookieService = new CookieService(new CookieOptions());
cookieService.putObject('machine_config_id', machineIdStub);
cookieService.putObject('machine_config_details', machineConfigStub);
httpClientService = {
get(url: string) {
let response = new ResponseOptions({ body: machineConfigStub });
return Observable.throw('invalid config');
}
};
fixture = new SetupService(httpClientService, cookieService);
});
开发者ID:crdschurch,项目名称:crds-signin-checkin,代码行数:12,代码来源:setup.service.spec.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: logOut
logOut(){
this._cookieService.remove("userName");
this._cookieService.remove("password");
this._cookieService.remove("userType");
this._cookieService.remove("userCode");
this._router.navigate(['LogIn']);
this._cookieService.get
}
开发者ID:APROTEC,项目名称:Web-Application,代码行数:8,代码来源:navbarAssociate.component.ts
示例5: 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
示例6: baseHeaders
public baseHeaders() {
let headers: Headers = new Headers();
if (this.cookies.get("csrftoken") == null) {
this.http.get("/api/auth/csrf").subscribe();
}
headers.append("X-CSRFTOKEN", this.cookies.get("csrftoken"));
return headers;
}
开发者ID:BenjaminSchubert,项目名称:HttpInfrastructure,代码行数:9,代码来源:headers.provider.ts
示例7: Observable
this.user$ = new Observable(observer => {
this._userObserver = observer;
var username = this._cookieService.get('username');
var token = parseInt(this._cookieService.get('token'));
if(username !== undefined && token !== undefined){
this.setUserModel(username, token);
}
}).share();
开发者ID:KHAAAAN,项目名称:ang2blog,代码行数:11,代码来源:user.service.ts
示例8: 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
示例9: remove
remove(key) {
this.cache[key] = null;
delete this.cache[key];
this._cookieService.remove(key);
this._localStorage.remove(key);
}
开发者ID:busidex-vinbrown,项目名称:orgadmin,代码行数:7,代码来源:cache.service.ts
示例10:
this.userService.login(email, password).subscribe((result) => {
if (result) {
console.log(result)
this._cookieService.putObject("auth", result);
this.router.navigate(['bucketlist']);
}
});
开发者ID:andela-gogbara,项目名称:Lifelist-angular2,代码行数:7,代码来源:registration.component.ts
注:本文中的angular2-cookie/core.CookieService类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论