<ion-item>
<ion-label >{{ 'branch' | translate }}</ion-label>
<ion-select [(ngModel)]="defualtBranch"
okText="{{ 'okText' | translate }}"
cancelText="{{ 'cancelText' | translate }}"
[selectOptions]="{{ 'selectOptionsBranch' | translate }}" >
<ion-option *ngFor="let branch of branchs; let i=index" value="{{branch.BranchCode}}">
{{branch.BranchName}}
</ion-option>
</ion-select>
</ion-item>
如何使用selectoptions multi-lang?
不工作此行[selectOptions]="{{ 'selectOptionsBranch' | translate }}"
在html中,将 [selectOptions]="{{ 'selectOptionsBranch' | translate }}"
更改为 [selectOptions]="selectOptionsBranch"
:
在打字稿中使用此代码:
import { TranslateService } from 'ng2-translate';
export class IntroPage {
selectOptionsBranch:any;
constructor(public navCtrl: NavController,translate: TranslateService) {
translate.use("fa");
translate.get('selectOptionsBranch').subscribe(
value => {
console.log(value);
this.selectOptionsBranch = value;
}
)
}
}