存儲庫中的示例與您正在查找的不一樣嗎? person
屬性通過settings
對象(model: this.person
)傳遞給對話服務。這可能是您從服務器獲取的數據。正如您所提到的,您當然也可以向模型中添加多個對象,這些對象將在對話框vm的activate()
方法中提供。
import {EditPerson} from './edit-person';
import {DialogService} from 'aurelia-dialog';
export class Welcome {
static inject = [DialogService];
constructor(dialogService) {
this.dialogService = dialogService;
}
person = { firstName: 'Wade', middleName: 'Owen', lastName: 'Watts' };
submit(){
this.dialogService.open({ viewModel: EditPerson, model: this.person}).then(response => {
if (!response.wasCancelled) {
console.log('good - ', response.output);
} else {
console.log('bad');
}
console.log(response.output);
});
}
}