import * as system from 'durandal/system'; import * as dialog from 'plugins/dialog'; import {ViewModel, Component, TrackChanges} from '@dezrez/core'; @Component({ view: require('./dialogs.html') }) export class Dialogs extends ViewModel { test: string = 'Hello'; constructor() { super(); } @TrackChanges('dialogs') alert() { this.test = 'update hello'; return dialog.showMessage('Sample alert message', 'Alert!'); } confirm() { return dialog.showMessage('Sample confirmation dialog', 'Confirm', ['OK', 'Cancel']); } prompt() { const Dialog = require('./viewModels/prompt/prompt'); return dialog.show( new Dialog(), [ 'Enter some text' ]) .then((result) => { console.info('User entered: ', result); }); } hello() { return system.defer((dfd) => { dfd.resolve(require('./viewModels/hello/hello')); }) .then((Dialog: any) => { return dialog.show(new Dialog(), [ 'Enter some text' ]); }) .then((result) => { console.info('User entered: ', result); }); } }