本文整理汇总了TypeScript中ng2-slim-loading-bar.SlimLoadingBarService.start方法的典型用法代码示例。如果您正苦于以下问题:TypeScript SlimLoadingBarService.start方法的具体用法?TypeScript SlimLoadingBarService.start怎么用?TypeScript SlimLoadingBarService.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ng2-slim-loading-bar.SlimLoadingBarService
的用法示例。
在下文中一共展示了SlimLoadingBarService.start方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ngOnInit
public ngOnInit() {
// Mouseflow integration
if ((window as any)._mfq) {
(window as any)._mfq.push(['newPageView', '/appointment/patient']);
}
// Set up page
this._state.isSubPage.next(true);
this._state.title.next();
this._state.actions.next();
this._state.primaryAction.next();
// Retrieve patient to be displayed from route and retrieve data from service
const param: string = this.route.snapshot.params['id'];
this.slimLoadingBarService.start();
this.patientService.patientFindById(param)
.subscribe(
(patient) => {
this.patient = patient;
this._state.title.next(patient.givenName + ' ' + patient.surname);
this.findAppointmentsForPatient(this.patient.id);
},
(err) => console.log(err)
);
// Set up localized humanizer for durations
this.localeHumanizer = humanizeDuration.humanizer({
language: localStorage.getItem('locale').startsWith('de') ? 'de' : 'en'
});
}
示例2: http
http(options: any) {
let method: string = options.method || 'GET';
let url = options.url ? options.url : '/api' + options.path;
let args = [ url ];
let headers = new Headers();
if (options.data) {
headers.set('Content-Type', 'application/json');
args.push(JSON.stringify(options.data));
}
if (this.authToken) {
headers.set('Authorization', 'Bearer ' + this.authToken);
}
let query = new URLSearchParams();
if (options.query) {
_.each(options.query, function(value, key) {
query.set(key, value);
});
}
args.push(new RequestOptions({
headers: headers,
search: query
}));
this.slimLoader.height = '4px';
this.slimLoader.start();
return this._http[method.toLowerCase()].apply(this._http, args).finally(() => {
this.slimLoader.complete();
});
}
示例3: ngOnInit
public ngOnInit() {
// Mouseflow integration
if ((window as any)._mfq) {
(window as any)._mfq.push(['newPageView', '/appointment/accept']);
}
// Set up page
this._state.isSubPage.next(true); // TODO block this #114
this._state.title.next(
localStorage.getItem('locale').startsWith('de') ? 'Terminbestätigung' : 'Accept Appointment');
this._state.actions.next();
this._state.primaryAction.next();
// Retrieve data
this.slimLoadingBarService.start();
this.appointmentService.appointmentAcceptOffer(this.route.snapshot.params['secret'])
.subscribe(
(appointment) => this.acceptedAppointment = appointment,
(err) => {
console.log(err);
if (err._body.error.status === 404 && err._body.error.code === 'NOT_FOUND_OR_EXPIRED') {
this.failed = true;
} else {
console.log(err);
}
},
() => {
this.slimLoadingBarService.complete();
console.log('Accepted offer successfully.');
}
);
}
示例4: runSlimLoader
private runSlimLoader(): void {
this.slimLoader.start();
setTimeout(() => this.slimLoader.progress = 14, 200);
setTimeout(() => this.slimLoader.progress = 17, 400);
setTimeout(() => this.slimLoader.progress = 20, 500);
setTimeout(() => this.slimLoader.complete(), 800);
}
示例5: searchMovie
searchMovie(title: string) {
this.slimLoader.start();
this.movieService.searchMovie(title)
.subscribe(res => this.movieSearchResults = res.results,
(error: any) => console.log(error),
() => this.slimLoader.complete()
);
}
示例6: if
this.sub = this.router.events.subscribe(event => {
if (event instanceof NavigationStart) {
this.slimLoader.start();
} else if ( event instanceof NavigationEnd ||
event instanceof NavigationCancel ||
event instanceof NavigationError) {
this.slimLoader.complete();
}
}, (error: any) => {
示例7: requestHelper
private requestHelper(additionalOptions?:RequestOptions){
this.loading.start(() => {
});
let options:RequestOptions = ApiAuth.createHttpOptions();
if (additionalOptions) {
options = options.merge(additionalOptions);
}
let req = this.http.request(new Request(options));
req.subscribe(res => this.HandleReponse(res), error => this.HandleError(error));
return req;
}
示例8: request
request(method: RequestMethod, url: string, data?: any) {
this.loadingBar.color = 'blue';
this.loadingBar.start();
let options = this.createOptions(method, data);
return this.http.request(url, options)
.map((response: Response) => {
this.loadingBar.color = 'green';
this.loadingBar.complete();
try {
return response.json() || {};
} catch(e) {
return {};
}
})
.catch((err: any) => this.handleError(err));
}
示例9: startProgress
startProgress() {
// We can listen when loading will be completed
this.slimLoader.start(() => {
console.log('Loading complete');
});
}
示例10: runSlimLoader
runSlimLoader() {
this.slimLoadingBarService.start();
setTimeout(() => {
this.slimLoadingBarService.complete();
}, 1000);
}