Skip to content

Instantly share code, notes, and snippets.

@AbraaoAlves
Created March 14, 2018 01:53
Show Gist options
  • Save AbraaoAlves/9e5957184f1ad22aacd337aac1f01e8f to your computer and use it in GitHub Desktop.
Save AbraaoAlves/9e5957184f1ad22aacd337aac1f01e8f to your computer and use it in GitHub Desktop.
Dialog stuff
<template>
<h1>Dialog Repro</h1>
<button click.delegate="dt.openDialogA()">Open Dialog</button>
</template>
import { DialogTrigger } from './dialog-trigger';
export class App {
static inject = [DialogTrigger];
constructor(dialogTrigger) {
this.dt = dialogTrigger;
}
}
import { DialogService } from 'aurelia-dialog';
export class DialogTrigger {
static inject = [DialogService];
constructor(dialogService) {
this._dialogService = dialogService;
}
openDialogA() { this._dialogService.open({ viewModel: './prompt' }); }
openDialogB() { this._dialogService.open({ viewModel: './prompt' }); }
}
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body aurelia-app="main">
<h1>Loading...</h1>
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/jspm_packages/system.js"></script>
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/config.js"></script>
<script>
System.import('aurelia-bootstrapper');
</script>
</body>
</html>
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging()
.plugin('aurelia-validation')
.plugin('aurelia-dialog');
aurelia.start().then(a => a.setRoot());
}
<template>
<ai-dialog>
<ai-dialog-body>
<h5 click.delegate="dt.openDialogB()">Open dialog B</h5>
</ai-dialog-body>
<ai-dialog-footer>
<input placeholder="click me" attach-focus="true" value.bind="firstName" />
<button click.trigger="dialogController.cancel()">Cancel</button>
<button click.trigger="dialogController.ok()">Ok</button>
</ai-dialog-footer>
</ai-dialog>
</template>
import { DialogController } from 'aurelia-dialog';
import { DialogTrigger } from './dialog-trigger';
import {Validator} from 'aurelia-validation';
export class Prompt {
static inject = [DialogController, DialogTrigger, Validator];
firstName = 'abraao';
validator = null;
constructor(dialogController, dialogTrigger, validator) {
this.dialogController = dialogController;
this.dt = dialogTrigger;
this.validator = validator;
}
activate(person){
this.person = person;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment