Last active
October 23, 2016 13:08
-
-
Save bcanzanella/36801eb2a5cd9059be3c34be492ee990 to your computer and use it in GitHub Desktop.
dialog not re-binding (with fooChanged)
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> | |
| <button click.delegate="prompt()">open dialog</button> | |
| <br><br> | |
| <div>${foo}</div> | |
| </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 {bindable} from 'aurelia-framework'; | |
| import {Prompt} from './prompt'; | |
| import {DialogService} from 'aurelia-dialog'; | |
| export class App { | |
| @bindable foo; | |
| static inject = [DialogService]; | |
| constructor(dialogService) { | |
| this.dialogService = dialogService; | |
| this.foo ='started' | |
| let me = this; | |
| setTimeout(function() { | |
| me.foo = 'replaced'; | |
| },10000) | |
| } | |
| prompt() { | |
| return this.dialogService.open({viewModel: Prompt, model: this.foo}); | |
| } | |
| } |
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(() => aurelia.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> | |
| <div>${foo}</div> | |
| </ai-dialog-body> | |
| <ai-dialog-footer> | |
| <button click.trigger="controller.cancel()">Cancel</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'; | |
| import {bindable} from 'aurelia-framework'; | |
| export class Prompt { | |
| static inject = [DialogController]; | |
| @bindable foo; | |
| constructor(controller){ | |
| this.controller = controller; | |
| } | |
| activate(outer) { | |
| this.foo = foo; | |
| } | |
| fooChanged(newValue) { | |
| alert(newValue) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment