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

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

      • <bdo id='qZ94T'></bdo><ul id='qZ94T'></ul>

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

      <legend id='qZ94T'><style id='qZ94T'><dir id='qZ94T'><q id='qZ94T'></q></dir></style></legend>

        無法讀取未定義 angular2 ngif 的屬性

        Cannot read property of undefined angular2 ngif(無法讀取未定義 angular2 ngif 的屬性)

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

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

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

                    <tbody id='QdpPj'></tbody>
                  <tfoot id='QdpPj'></tfoot>
                • 本文介紹了無法讀取未定義 angular2 ngif 的屬性的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我現在可以在視圖中獲取對象,但是我無法運行 if 語句.根據之前的回答,這就是我引入對象的方式.

                  I am now able to get the object in the view however I cannot run an if statement. Per previous answer this is how I am bringing in the object.

                  public getPosts$(category, limit) {
                    return this.cartService.getPosts(category, limit).map(response => {
                      return response && response.data && response.data.children;
                    };
                  }
                  
                  ngOnInit() {
                    this.getPosts$(this.category, this.limit).subscribe(cart => {
                      this.cart = cart;
                    }
                  }
                  

                  我正在嘗試運行,但無法獲得屬性蔬菜.

                  I am trying to run but get cannot get property vegetable.

                  <h2 *ngIf="cart">{{cart.vegetable}}</h2>
                  <h2 *ngIf="cart.vegetable == 'carrot' ">{{cart.vegetable}}</h2>
                  

                  錯誤是

                  無法讀取未定義的屬性vegtable"

                  Cannot read property 'vegtable' of undefined

                  推薦答案

                  cart 對象為空,直到服務 getPosts$ 返回(回調).因此,代碼 *ngIf="cart.vegetable ... 等于 *ngIf="null.vegetable ... 直到發生這種情況.這就是正在發生的事情.

                  The cart object is null until the service getPosts$ returns (callback). Therefore, the code *ngIf="cart.vegetable ... is equal to *ngIf="null.vegetable ... until that happens. That is what is happening.

                  您可以做的是放置一個帶有 *ngIf="cart" 的 DOM 元素,其中包含另一個 *ngIf.例如:

                  What you could do is put a DOM element with *ngIf="cart" containing the other *ngIf. For example:

                  <div *ngIf="cart">
                      <h2 *ngIf="cart.vegetable == 'carrot' ">{{cart.vegetable}}</h2>
                  </div>
                  

                  *正如在下一個答案中所說,一個很好的選擇(和良好的做法)如下:

                  * As it is said in the next answer, a good alternative (and good practice) is the following:

                  <h2 *ngIf="cart?.vegetable == 'carrot' ">{{cart.vegetable}}</h2>

                  這篇關于無法讀取未定義 angular2 ngif 的屬性的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)

                  • <small id='IcJxx'></small><noframes id='IcJxx'>

                    <tfoot id='IcJxx'></tfoot>
                      <bdo id='IcJxx'></bdo><ul id='IcJxx'></ul>

                        <tbody id='IcJxx'></tbody>
                      <i id='IcJxx'><tr id='IcJxx'><dt id='IcJxx'><q id='IcJxx'><span id='IcJxx'><b id='IcJxx'><form id='IcJxx'><ins id='IcJxx'></ins><ul id='IcJxx'></ul><sub id='IcJxx'></sub></form><legend id='IcJxx'></legend><bdo id='IcJxx'><pre id='IcJxx'><center id='IcJxx'></center></pre></bdo></b><th id='IcJxx'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='IcJxx'><tfoot id='IcJxx'></tfoot><dl id='IcJxx'><fieldset id='IcJxx'></fieldset></dl></div>
                        1. <legend id='IcJxx'><style id='IcJxx'><dir id='IcJxx'><q id='IcJxx'></q></dir></style></legend>
                          • 主站蜘蛛池模板: 国产成人久久av免费高清密臂 | 一区二区三区在线 | 欧 | 在线观看成年视频 | 日韩精品一区二区三区在线 | 亚洲精品视频在线观看免费 | 一区二区久久 | 午夜不卡福利视频 | 国产视频久久 | 国产激情精品视频 | 欧美精品在线一区二区三区 | 久久三区| 中文字幕第90页 | 亚洲日韩中文字幕一区 | 激情五月激情综合网 | 国产99久久久国产精品 | 99精品九九 | 国产日韩欧美一区二区在线播放 | 国产精品久久久久久久三级 | h视频免费在线观看 | 成人一区二区三区在线观看 | 成人在线一区二区 | 欧美jizzhd精品欧美巨大免费 | 99热最新 | 一级在线免费观看 | 日韩欧美一区二区三区 | 午夜欧美一区二区三区在线播放 | 欧美一区二区 | 亚洲综合色视频在线观看 | 国产精品欧美精品 | 中文字幕国产 | 国产精品久久久久久久久久久久午夜片 | 永久av| 久久久九九九九 | 亚洲理论在线观看电影 | 久久成人国产 | 综合第一页 | 国产美女永久免费无遮挡 | 在线观看av网站永久 | 成人久久网 | 国产视频福利一区 | www.日日操 |