当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ng2-slim-loading-bar.SlimLoadingBarService类代码示例

本文整理汇总了TypeScript中ng2-slim-loading-bar.SlimLoadingBarService的典型用法代码示例。如果您正苦于以下问题:TypeScript SlimLoadingBarService类的具体用法?TypeScript SlimLoadingBarService怎么用?TypeScript SlimLoadingBarService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SlimLoadingBarService类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: 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) => {
开发者ID:akserg,项目名称:ng2-webpack-demo,代码行数:9,代码来源:app.component.ts

示例2: handleError

    private handleError(error: Response | any) {
        this.loadingBar.color = 'red';
        this.loadingBar.complete();

        let message: string;
        if (error instanceof Response) {
            if (error.status === 0) {
                message = `Could not reach the bhmc server because your internet connection 
                           was lost, the connection timed out, or the server is not responding.`;
            } else {
                const body = error.json() || {};
                if (body.non_field_errors) {
                    // django-rest-auth
                    message = body.non_field_errors[0];
                } else if (body.username) {
                    // django-rest-auth
                    message = body.username[0];
                } else if (body.detail) {
                    // django-rest-framework
                    message = body.detail;
                } else {
                    message = JSON.stringify(body);
                }
            }
            this.errorHandler.logResponse(message, error);
        } else {
            this.errorHandler.logError(error);
            message = error.message ? error.message : error.toString();
        }

        this.errorSource.next(message);
        return Observable.throw(message);
    }
开发者ID:finleysg,项目名称:bhmc,代码行数:33,代码来源:bhmc-data.service.ts

示例3: 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();
    });
  }
开发者ID:AlphaHydrae,项目名称:doa,代码行数:34,代码来源:api.service.ts

示例4: 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'
    });
  }
开发者ID:carolduan,项目名称:medical-appointment-scheduling,代码行数:31,代码来源:patient.component.ts

示例5: 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.');
      }
    );
  }
开发者ID:carolduan,项目名称:medical-appointment-scheduling,代码行数:32,代码来源:accept-offer.component.ts

示例6: 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);
 }
开发者ID:adriancarriger,项目名称:udacity-meetup,代码行数:7,代码来源:app.component.ts

示例7: 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()
         );
 }
开发者ID:,项目名称:,代码行数:8,代码来源:

示例8: catch

 .map((response: Response) => {
     this.loadingBar.color = 'green';
     this.loadingBar.complete();
     try {
         return response.json() || {};
     } catch(e) {
         return {};
     }
 })
开发者ID:finleysg,项目名称:bhmc,代码行数:9,代码来源:bhmc-data.service.ts

示例9: 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;
    }
开发者ID:luciancaetano,项目名称:curly-app-base,代码行数:12,代码来源:auth.api.ts

示例10: 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));
 }
开发者ID:finleysg,项目名称:bhmc,代码行数:16,代码来源:bhmc-data.service.ts


注:本文中的ng2-slim-loading-bar.SlimLoadingBarService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。