我正在开发一个离子应用程序,在其中使用*ngFor="let playerValue of players"
在HTML文件中获取价值
但是在插值{{playerValue.playerPhoto}}
或playerValue.playerType
时使用html中的playerValue或playerType之类的playerValue属性会出现错误
例如:-
<img src={{playerValue.playerPhoto}}></button>
或
<div *ngSwitchCase="playerValue.playerType">
错误消息是-:
[角度]标识符'playerType'未定义。 ''确实 不包含这样的成员
或
[角度]标识符'playerPhoto'未定义。 ''确实 不包含这样的成员
出现错误的
<ion-content no-padding>
<div class="create-team-section">
<ion-list class="team-create-list">
<div [ngSwitch]="playerType" *ngFor="let playerValue of players |
search : terms| sort: {property: column, order: order}; let i = index">
<div *ngSwitchCase="playerValue.playerType" ngSelected="selected">
<ion-item [class.active]="playerValue.isSelected? 'active' : null">
<ion-grid no-padding>
<!-- <a (click)="playerInfo()"><img src={{playerValue.playerPhoto}}></a> -->
<ion-row align-items-center [class.shake]="shake==playerValue.playerUid ? 'shake' : null">
<ion-col col-3>
<!-- <div class="create-team-imge" >
<img src={{playerValue.playerPhoto}}>
</div> -->
<div class="create-team-imge">
<ion-avatar item-star no-line>
<button (click)="playerinfo(i)"><img src={{playerValue.playerPhoto}}></button>
</ion-avatar>
<ion-badge>
<ion-icon name="information"></ion-icon>
</ion-badge>
</div>
</ion-col>
<ion-col col-md-9 col-9 (click)="setClickedRow(i)">
<ion-row align-items-center>
<ion-col col-md-8 col-7>
<p>{{playerValue.playerName}}</p>
<p>Selected By {{playerValue.selectedBy}}</p>
<p class="country" >{{playerValue.teamName}}</p>
<p class="points"> Points:
<span>{{playerValue.totalPoint}}</span>
</p>
</ion-col>
<ion-col col-md-4 col-5 class="cradit">
<p>
<span>{{playerValue.playerCreditPoint}}</span>
</p>
<button ion-button icon-only>
<ion-icon [name]="playerValue.isSelected? 'close' : 'ios-checkmark'"></ion-icon>
</button>
</ion-col>
</ion-row>
</ion-col>
</ion-row>
</ion-grid>
</ion-item>
</div>
</div>
</ion-list>
</div>
</ion-content>
ts文件
export class CreateteamPage {
players: any = [];
答案 0 :(得分:0)
尝试创建这样的界面
export interface Players {
playerType: string;
playerPhoto: string;
}
在您的ts文件中:
import { Players } from './models/players' // path to the interface
export class CreateteamPage {
players: Players[];
// rest of the code
}
答案 1 :(得分:0)
尝试使用安全参数ORG 0000H
LJMP MAIN
MAIN:
MOV TMOD, #001h ; Mod 1 timer 0 (16 bit) ;2Cycles
TIMER: ; The counter start at FAA5h
MOV TL0, #0A5h ;2Cycles
MOV TH0, #0FAh ;2Cycles
SETB TR0 ;Start timer 0 ;3Cycles
AGAIN1: JNB TF0, AGAIN1 ;2Cycles
CLR TR0 ;Stop timer0 ;3Cycles
CLR TF0 ;Clear Flag ;3Cycles
CPL P1.0 ;3Cycles
JMP TIMER ;2Cycles
END
:
?
和
<img src={{playerValue?.playerPhoto}}></button>