久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    • <bdo id='KuQz8'></bdo><ul id='KuQz8'></ul>
    <legend id='KuQz8'><style id='KuQz8'><dir id='KuQz8'><q id='KuQz8'></q></dir></style></legend>

    <small id='KuQz8'></small><noframes id='KuQz8'>

  • <tfoot id='KuQz8'></tfoot>
  • <i id='KuQz8'><tr id='KuQz8'><dt id='KuQz8'><q id='KuQz8'><span id='KuQz8'><b id='KuQz8'><form id='KuQz8'><ins id='KuQz8'></ins><ul id='KuQz8'></ul><sub id='KuQz8'></sub></form><legend id='KuQz8'></legend><bdo id='KuQz8'><pre id='KuQz8'><center id='KuQz8'></center></pre></bdo></b><th id='KuQz8'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='KuQz8'><tfoot id='KuQz8'></tfoot><dl id='KuQz8'><fieldset id='KuQz8'></fieldset></dl></div>

        Angular 2 HTTP 進度條

        Angular 2 HTTP Progress bar(Angular 2 HTTP 進度條)
        • <tfoot id='3w5hq'></tfoot>

        • <legend id='3w5hq'><style id='3w5hq'><dir id='3w5hq'><q id='3w5hq'></q></dir></style></legend>

            • <bdo id='3w5hq'></bdo><ul id='3w5hq'></ul>
                <tbody id='3w5hq'></tbody>

              <small id='3w5hq'></small><noframes id='3w5hq'>

                  <i id='3w5hq'><tr id='3w5hq'><dt id='3w5hq'><q id='3w5hq'><span id='3w5hq'><b id='3w5hq'><form id='3w5hq'><ins id='3w5hq'></ins><ul id='3w5hq'></ul><sub id='3w5hq'></sub></form><legend id='3w5hq'></legend><bdo id='3w5hq'><pre id='3w5hq'><center id='3w5hq'></center></pre></bdo></b><th id='3w5hq'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='3w5hq'><tfoot id='3w5hq'></tfoot><dl id='3w5hq'><fieldset id='3w5hq'></fieldset></dl></div>
                  本文介紹了Angular 2 HTTP 進度條的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  目前在 Angular 2 中是否有一種方法可以使用 angular2/http 模塊檢索 ajax 調用的進度(即完成百分比)?

                  Is there currently a way within Angular 2 to retrieve the progress (i.e. percentage done) of an ajax call, using the angular2/http module?

                  我使用以下代碼進行 HTTP 調用:

                  I use the following code to make my HTTP calls:

                          let body = JSON.stringify(params);
                          let headers = new Headers({ 'Content-Type': 'application/json' });
                          let options = new RequestOptions({ headers: headers });
                          this.http.post(url, body, options)
                              .timeout(10000, new Error('Timeout exceeded during login'))
                              .toPromise()
                              .then((res) => {
                                  ...
                              }).catch((err) => {
                                  ...
                              });
                  

                  目標是編寫一個同步系統.帖子會返回大量數據,我想告訴用戶同步需要多長時間.

                  The goal is to write a synchronisation system. The post will return a lot of data, and I want to give the user an indication on how long the syncing will take.

                  推薦答案

                  目前(從 v. 4.3.0 開始,當使用來自 @ngular/common/httpHttpClient 時>) Angular 提供開箱即用的監(jiān)聽進度.您只需要創(chuàng)建 HTTPRequest 對象,如下所示:

                  Currently (from v. 4.3.0, when using new HttpClient from @ngular/common/http) Angular provides listening to progress out of the box. You just need to create HTTPRequest object as below:

                  import { HttpRequest } from '@angular/common/http';
                  ...
                  
                  const req = new HttpRequest('POST', '/upload/file', file, {
                    reportProgress: true,
                  });
                  

                  當您訂閱請求時,您將在每個進度事件中調用訂閱:

                  And when you subscribe to to request you will get subscription called on every progress event:

                  http.request(req).subscribe(event => {
                    // Via this API, you get access to the raw event stream.
                    // Look for upload progress events.
                    if (event.type === HttpEventType.UploadProgress) {
                      // This is an upload progress event. Compute and show the % done:
                      const percentDone = Math.round(100 * event.loaded / event.total);
                      console.log(`File is ${percentDone}% uploaded.`);
                    } else if (event instanceof HttpResponse) {
                      console.log('File is completely uploaded!');
                    }
                  });
                  

                  更多信息這里.

                  這篇關于Angular 2 HTTP 進度條的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                  anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項目中不起作用)
                  Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動態(tài)元素 - Angular 2 amp;離子2)
                  How to reload the ion-page after pop() in ionic2(如何在 ionic2 中的 pop() 之后重新加載離子頁面)
                  Retrieve localstorage value when value is change in Ionic 2(當 Ionic 2 中的值發(fā)生變化時檢索本地存儲值)

                  1. <small id='acKtE'></small><noframes id='acKtE'>

                      <tfoot id='acKtE'></tfoot>

                        • <bdo id='acKtE'></bdo><ul id='acKtE'></ul>
                            <tbody id='acKtE'></tbody>
                            <legend id='acKtE'><style id='acKtE'><dir id='acKtE'><q id='acKtE'></q></dir></style></legend>
                          • <i id='acKtE'><tr id='acKtE'><dt id='acKtE'><q id='acKtE'><span id='acKtE'><b id='acKtE'><form id='acKtE'><ins id='acKtE'></ins><ul id='acKtE'></ul><sub id='acKtE'></sub></form><legend id='acKtE'></legend><bdo id='acKtE'><pre id='acKtE'><center id='acKtE'></center></pre></bdo></b><th id='acKtE'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='acKtE'><tfoot id='acKtE'></tfoot><dl id='acKtE'><fieldset id='acKtE'></fieldset></dl></div>
                            主站蜘蛛池模板: 国产成人午夜精品影院游乐网 | 色婷婷综合久久久久中文一区二区 | 鸳鸯谱在线观看高清 | 亚洲一区二区在线免费观看 | 久草新在线 | 在线观看成人小视频 | 99国产精品久久久 | 日本中文字幕日韩精品免费 | av中文字幕在线观看 | 免费成人毛片 | 欧美在线观看一区 | 国产精品久久 | 久久久久中文字幕 | 国产精品综合网 | 91精品久久久久久久久久 | 紧缚调教一区二区三区视频 | 亚洲91精品| 免费黄篇| 国产精品国产精品国产专区不卡 | 久久在线 | 91玖玖| 欧美一区二区久久 | 亚洲精品66| 波多野结衣二区 | 91精品国产综合久久久久久丝袜 | 在线观看www | 国产高清精品一区二区三区 | 国产精品国产 | 国产精品美女久久久久aⅴ国产馆 | 国产精品爱久久久久久久 | 日韩欧美三级电影 | 中文字幕高清av | 日本一区二区在线视频 | 中文区中文字幕免费看 | 欧美毛片免费观看 | 91久久国产综合久久 | 成人精品网 | 亚洲精品中文在线观看 | 精品久久久久久国产 | 91高清免费观看 | 亚洲精品99 |