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

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

    <legend id='OOolB'><style id='OOolB'><dir id='OOolB'><q id='OOolB'></q></dir></style></legend>
  • <small id='OOolB'></small><noframes id='OOolB'>

      <bdo id='OOolB'></bdo><ul id='OOolB'></ul>
      1. <tfoot id='OOolB'></tfoot>

      2. 在渲染“頁面"之前獲取數據異步

        Get data async before a `Page` gets rendered(在渲染“頁面之前獲取數據異步)
        <i id='AAGWy'><tr id='AAGWy'><dt id='AAGWy'><q id='AAGWy'><span id='AAGWy'><b id='AAGWy'><form id='AAGWy'><ins id='AAGWy'></ins><ul id='AAGWy'></ul><sub id='AAGWy'></sub></form><legend id='AAGWy'></legend><bdo id='AAGWy'><pre id='AAGWy'><center id='AAGWy'></center></pre></bdo></b><th id='AAGWy'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='AAGWy'><tfoot id='AAGWy'></tfoot><dl id='AAGWy'><fieldset id='AAGWy'></fieldset></dl></div>
          • <bdo id='AAGWy'></bdo><ul id='AAGWy'></ul>

            <tfoot id='AAGWy'></tfoot>
                <tbody id='AAGWy'></tbody>

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

                  <legend id='AAGWy'><style id='AAGWy'><dir id='AAGWy'><q id='AAGWy'></q></dir></style></legend>
                  本文介紹了在渲染“頁面"之前獲取數據異步的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  在渲染 Page 之前獲取數據異步的正確方法是什么?

                  What is the correct way to get data async before a Page gets rendered?

                  Angular2 建議使用 @CanActivate 裝飾器.可悲的是,這不適用于 Ionic2,至少不適用于我和 其他

                  Angular2 suggests the @CanActivate decorator as far as I understand it. Sadly this is not working with Ionic2, at least not for me and for others

                  顯然 Ionic2 使用 @CanActivate 裝飾器 見但它沒有記錄,我無法弄清楚它到底做了什么.

                  Apparently Ionic2 does something with the @CanActivate decorator, see But its not documented and i can't figure out what it does exactly.

                  盡管如此 這家伙指出應該使用 無論如何,由于離子緩存,離子視圖狀態.他的例子是這樣的:

                  Nevertheless this guy points out one should use Ionics View States instead anyways, due to ionics caching. His example looks like this:

                    onPageWillEnter() { 
                        return this._service.getComments().then(data => this.comments = data);
                    }
                  

                  看起來他希望 Ionic 考慮返回的承諾,但是 快速瀏覽 離子源顯示(至少我是這么認為的)返回值被忽略.因此,不能保證在頁面呈現之前 會解決承諾.這是一個帶有 onPage* 的 示例,以及它沒有按需要/預期執行的原因.

                  Which looks like he is expecting Ionic to consider the returned promise, but a quick glance a Ionics sources reveals (at least I think so) that the returned value is ignored. Hence there is no guarantee that the promise gets resolved before the page gets rendered. Here is an example with onPage* and how it does not perform as needed/expected.

                  所以我迷路了,如何完成這個簡單的任務?

                  So I'm lost, how does one achieve this simple task?

                  在第一個鏈接中,建議在導航到頁面之前解析數據,這會增加被調用者知道頁面需要哪些數據的負擔.在我看來,這不是一個選擇.

                  In the first link, it was suggested to resolve the data before navigating to the page, which burdens the knowledge which data is needed for the page on the callee. This is not an option in my opinion.

                  *添加反例

                  推薦答案

                  對于在使用 Ionic 2 時對 Stackoverflow 進行限制頁面訪問的任何人來說,Ionic 推薦的生命周期事件似乎是 ionViewCanEnter.

                  For anyone crawling Stackoverflow about restricting page access when using Ionic 2, it looks like Ionic's recommended lifecycle event to tap into is ionViewCanEnter.

                  來自文檔:

                  ionViewCanEnter 在視圖進入之前運行.這可以用作經過身份驗證的視圖中的一種守衛",您需要在視圖進入之前檢查權限.

                  ionViewCanEnter Runs before the view can enter. This can be used as a sort of "guard" in authenticated views where you need to check permissions before the view can enter.

                  http://ionicframework.com/docs/v2/api/navigation/NavController/

                  這篇關于在渲染“頁面"之前獲取數據異步的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                  anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項目中不起作用)
                  Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數據更新 Observable)
                  Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                  In Ionic 2, how do I create a custom directive that uses Ionic components?(在 Ionic 2 中,如何創建使用 Ionic 組件的自定義指令?)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動態元素 - Angular 2 amp;離子2)

                  • <legend id='zD2XM'><style id='zD2XM'><dir id='zD2XM'><q id='zD2XM'></q></dir></style></legend>

                      <tfoot id='zD2XM'></tfoot>

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

                            <bdo id='zD2XM'></bdo><ul id='zD2XM'></ul>
                              <tbody id='zD2XM'></tbody>
                            <i id='zD2XM'><tr id='zD2XM'><dt id='zD2XM'><q id='zD2XM'><span id='zD2XM'><b id='zD2XM'><form id='zD2XM'><ins id='zD2XM'></ins><ul id='zD2XM'></ul><sub id='zD2XM'></sub></form><legend id='zD2XM'></legend><bdo id='zD2XM'><pre id='zD2XM'><center id='zD2XM'></center></pre></bdo></b><th id='zD2XM'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='zD2XM'><tfoot id='zD2XM'></tfoot><dl id='zD2XM'><fieldset id='zD2XM'></fieldset></dl></div>
                            主站蜘蛛池模板: 日韩精品视频在线免费观看 | 久久激情av | 欧美二区三区 | 亚洲日本中文字幕在线 | 九色91视频| 国产乱一区二区三区视频 | 国产精品亚洲精品久久 | 国产成人a亚洲精品 | 亚洲第一色站 | .国产精品成人自产拍在线观看6 | 国产成人一区二 | www.日韩在线 | 最新黄色毛片 | 在线看av的网址 | 男女网站免费观看 | 97超碰免费 | 天天看天天干 | 久热爱 | 91精品国产综合久久久久久 | 伊人超碰| 中文字幕男人的天堂 | 国产福利在线 | 中文字幕乱码一区二区三区 | 日本精品国产 | 久久国产精品免费 | 亚洲精品久久久久久久久久久久久 | 久久69精品久久久久久国产越南 | 日韩精品一区二区三区视频播放 | 国产成人免费在线 | 九九视频网 | 亚洲97| 91电影在线播放 | 亚洲视频免费观看 | 精品一区二区在线观看 | 天天看夜夜 | 国产精品有限公司 | 久久久免费毛片 | 超级碰在线 | 国产精品永久在线观看 | 精品日韩一区 | a级在线 |