-
-
Save glen-84/a6e89fba97da425413f5fc9b09e96090 to your computer and use it in GitHub Desktop.
DI inheritance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<h1>Dialog Repro</h1> | |
<button click.delegate="submit()">Open Dialog</button> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {DialogService} from 'aurelia-dialog'; | |
import {Prompt} from './prompt'; | |
export class App { | |
person = { name: 'Test' }; | |
static inject = [DialogService]; | |
constructor(dialogService) { | |
this.dialogService = dialogService; | |
} | |
submit(){ | |
this.dialogService.open({ viewModel: Prompt, model: this.person}).then(response => { | |
if (!response.wasCancelled) { | |
console.log('good'); | |
} else { | |
console.log('bad'); | |
} | |
console.log(response.output); | |
}); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function configure(aurelia) { | |
aurelia.use | |
.standardConfiguration() | |
.developmentLogging() | |
.plugin('aurelia-dialog'); | |
aurelia.start().then(a => a.setRoot()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<ai-dialog> | |
<ai-dialog-body> | |
<h2>Edit name</h2> | |
<input value.bind="person.name" /> | |
</ai-dialog-body> | |
<ai-dialog-footer> | |
<button click.trigger="controller.cancel()">Cancel</button> | |
<button click.trigger="controller.ok(person)">Ok</button> | |
</ai-dialog-footer> | |
</ai-dialog> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {DialogController} from 'aurelia-dialog'; | |
export class Prompt { | |
static inject = [DialogController]; | |
constructor(controller){ | |
this.controller = controller; | |
} | |
activate(person){ | |
this.person = person; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment