ngfor

    4熱度

    3回答

    您好我正在使用ngFor循環json字符串,但是可以顯示循環項目的數量而不是顯示其值嗎? 例如在我的部分我有 items = {item1, item2, item3, item4} ,並在HTML模板 <p *ngFor="let i of items>{{i}}</p> 那麼結果將是 item1 item2 item3 item4 ,但取而代之的是,因爲有四個對象中的項目,我

    -1熱度

    1回答

    我有12項以上,我需要在一個幻燈片分割顯示3項,接下來的3標題中下一張幻燈片 <ion-slides pager *ngFor="let item of list" let-i="index"> <ion-slide> <h2>{{item.text}}</h2> </ion-slide> </ion-slides>

    0熱度

    2回答

    我基本上試圖計數,然後由ngFor指令列出的列表數。我遵循了很多解決方案來解決我的問題,但這不是成功的。下面是我的代碼,我得到的錯誤,父母沒有定義。 管 @Pipe({name: 'keys'}) export class KeysPipe implements PipeTransform { parent : string; transform(value) : any

    0熱度

    2回答

    我如何可以訪問ngFor迴路元件的參考? 我在這裏做了一些示例。 在打字稿 public onUpload(itemId: number):void { // how can I access element? this.listContainer.nativeElement.scrollTo( ??? ); } 標記 <ul #list_container style=

    33熱度

    5回答

    按我的理解,兩者都做同樣的功能。但是, ngFor會像爲collections作品? ngForOf會像爲generics作品? 我的理解是正確的?或 能否請您對ngFor和ngForOf分享更差的(詳細信息)?

    2熱度

    1回答

    我使用的是* ngFor在角2版本:4.0.1填寫5個選擇列表頁面上用下面的代碼: select [(ngModel)]="_materialInput.code" (change)="onChange()" formControlName="code" class="form-control" id="code"> <option *ngFor="let x of _materialV

    2熱度

    2回答

    我遇到了一個問題,使用routerLink的div在點擊時會變成藍色。我認爲我錯過了一些非常明顯的東西,甚至可能是我在瀏覽器中的配置或一些錯過的CSS樣式,所以如果是這樣的話,對修正的禮貌解釋將不勝感激。 我已經把這個問題的基本演示放在這裏 - https://github.com/DavidStreid/routingIssue。創建此問題的代碼片段位於src/app/allGreetings.

    4熱度

    2回答

    我正在使用ngFor來循環8個json對象,我不僅要循環值,而且要計算循環值的數量並顯示數字。 例如,如果 JSON值 Content:{ 0:"Content1", 1:"Content2", 2:"Content3", 3:"Content4", 4:"Content5", 5:"Content6", 6:"Content7", 7:"Content8" } 我不僅要顯示

    0熱度

    4回答

    嗨,我很難理解ngIf。 目前我有 Profile:{ 0:{name: 'Jen', intro:'', gender:'female', age:'1992'}, 1:{name: 'John', intro:'Hi', gender:'male', age:'1988'} } 第一個對象的介紹是空字符串,當它具有空字符串我想顯示「用戶不寫它尚未」 JSON對象。 我試過

    0熱度

    2回答

    是否有可能在Angular中使用ngForum的多個數組? *ngFor="let device of element.devices && element.zones.devices"// something like this export interface Element { id: string; name: string; zones: Zone[];