久久久久久久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>

        無(wú)法讀取未定義 angular2 ngif 的屬性

        Cannot read property of undefined angular2 ngif(無(wú)法讀取未定義 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>
                • 本文介紹了無(wú)法讀取未定義 angular2 ngif 的屬性的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  我現(xiàn)在可以在視圖中獲取對(duì)象,但是我無(wú)法運(yùn)行 if 語(yǔ)句.根據(jù)之前的回答,這就是我引入對(duì)象的方式.

                  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;
                    }
                  }
                  

                  我正在嘗試運(yùn)行,但無(wú)法獲得屬性蔬菜.

                  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>
                  

                  錯(cuò)誤是

                  無(wú)法讀取未定義的屬性vegtable"

                  Cannot read property 'vegtable' of undefined

                  推薦答案

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

                  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.

                  您可以做的是放置一個(gè)帶有 *ngIf="cart" 的 DOM 元素,其中包含另一個(gè) *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>
                  

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

                  * 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>

                  這篇關(guān)于無(wú)法讀取未定義 angular2 ngif 的屬性的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                  anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項(xiàng)目中不起作用)
                  Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數(shù)據(jù)更新 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 中,如何創(chuàng)建使用 Ionic 組件的自定義指令?)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動(dòng)態(tài)元素 - 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在线 | 国产精品v | 国产91久久久久久久免费 | 久久久久久成人网 | 在线电影日韩 | 亚洲精品福利视频 | 欧美精品日韩精品 | 欧美日韩不卡合集视频 | 羞羞网站在线免费观看 | 久热国产精品 | 99精品99| 国产精品久久久久久影视 | 成人不卡视频 | 中文字幕一区二区三区四区 | 国产成人99| 国产午夜久久久 | 一区免费看 | 欧美美乳 | 久久新视频 | 国产精品久久久久久久久久久久 | 久久精品国内 | 欧美日韩一区二区三区四区五区 | 精品一区在线看 | 国产在线观看一区二区 | 亚洲精品乱码久久久久v最新版 |