第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

為什么這個(gè)數(shù)據(jù)不顯示

為什么這個(gè)數(shù)據(jù)不顯示

C#
哆啦的時(shí)光機(jī) 2022-11-21 21:32:12
我正在學(xué)習(xí) Angular,我從 Visual Studio 中名為 Angular5TF1 的示例項(xiàng)目開(kāi)始。示例中有一個(gè)名為“獲取數(shù)據(jù)”的菜單選項(xiàng),它模擬從服務(wù)器檢索數(shù)據(jù)。我復(fù)制了這個(gè)方法及其類(lèi)和頁(yè)面,并試圖讓它從我寫(xiě)的方法中檢索數(shù)據(jù) - 它不起作用..我從示例中復(fù)制了“FetchData”方法及其類(lèi)和頁(yè)面,并試圖讓它從我編寫(xiě)的方法中檢索數(shù)據(jù)。返回值顯示正確的值,但當(dāng)我嘗試顯示數(shù)組中的值之一時(shí),它返回未定義。此外,我返回 10 個(gè)值,for 循環(huán)打印 10 行,但它們都是空白的。有人可以解釋原因并幫助我完成這項(xiàng)工作嗎?提前致謝。從組件 html:<h1>Interests</h1><div class="col-lg-12">&nbsp;</div><div class="col-lg-10">    Interest:&nbsp;<input type="text" id="txtInterest" />&nbsp;<button (click)="test()">Add...</button></div><div class="col-lg-12">&nbsp;</div><div class="col-lg-12">&nbsp;</div><div class="col-lg-12">    <p *ngIf="!personalInterests"><em>Loading Interests, Please Wait...</em></p></div><table class='table' *ngIf="personalInterests">    <thead>        <tr>            <th>Interest Name</th>        </tr>    </thead>    <tbody>        <tr *ngFor="let interest of personalInterests">            <td>{{ interest.InterestName }}</td>        </tr>    </tbody></table>從組件import { Component, Inject } from '@angular/core';import { Http } from '@angular/http';//import { forEach } from '@angular/router/src/utils/collection';@Component({    selector: 'interests',    templateUrl: './interests.component.html'})export class InterestsComponent {    public personalInterests: PersonalInterest[];    constructor(http: Http, @Inject('BASE_URL') baseUrl: string) {        http.get(baseUrl + 'api/Interest/Interests').subscribe(result => {            this.personalInterests = result.json() as PersonalInterest[];        }, error => console.error(error));    }    public test() {        alert(this.personalInterests[1].InterestName);    }}interface PersonalInterest {    InterestName: string;}
查看完整描述

1 回答

?
海綿寶寶撒

TA貢獻(xiàn)1809條經(jīng)驗(yàn) 獲得超8個(gè)贊

使用 Camel Case 解決了這個(gè)問(wèn)題。



查看完整回答
反對(duì) 回復(fù) 2022-11-21
  • 1 回答
  • 0 關(guān)注
  • 107 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)