當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。