안녕하세요, 기본 대화 상자를 실행할 수는 있지만 대화 상자를 그대로 유지하고 직접 닫으려고합니다. 그게 가능하니?aurelia-dialog가 닫히지 않게하십시오.
현재 [확인] 단추를 클릭하면 즉시 대화 상자가 제거됩니다.
기본적으로 사용자 이름/비밀번호가있는 로그인 상자로 대화 상자를 만들고 싶습니다. 실패한 로그인 시도에서 대화 상자에 오류 메시지를 표시하고 닫지 않습니다.
내 템플릿은
<template>
<ai-dialog>
<ai-dialog-header>
</ai-dialog-header>
<ai-dialog-body>
<h2>Username:</h2>
<input value.bind="auth.username" attach-focus="true" />
<br />
<h2>Password:</h2>
<input value.bind="auth.password" attach-focus="false" />
<br /><br />
<span innerhtml.bind="auth.error">No Error</span>
</ai-dialog-body>
<ai-dialog-footer>
<button click.trigger="controller.ok(auth)">Ok</button>
</ai-dialog-footer>
</ai-dialog>
</template>
내가
let auth = { username: 'Wade', password: 'Watts', error : ""};
this.dialogService.openAndYieldController({viewModel: Login, model: auth}).then(controller => {
// Note you get here when the dialog is opened, and you are able to close dialog
// Promise for the result is stored in controller.result property
controller.result.then((response) => {
if (!response.wasCancelled) {
console.log('good');
} else {
console.log('bad');
}
console.log(response);
})
});
감사
'openAndYieldController()'(https://github.com/aurelia/dialog#getting-access-to-dialogcontroller-api-outside)를 사용하십시오. – valichek
openAndYieldController를 사용하여 시도했음을 언급해야합니다. 나는 그 질문을 편집했다. –
대화 상자에서 어떤보기를로드하고 있습니까? 대화 상자 내부의 viewmodel을 통해이를 제어 할 수 있어야합니다. –