-
-
Save charlespockert/60daa938ee7dcd255806c209cd6c797b to your computer and use it in GitHub Desktop.
This file contains 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> | |
<require from="nav-bar.html"></require> | |
<require from="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"></require> | |
<nav-bar router.bind="router"></nav-bar> | |
<div class="page-host" style="margin-top:50px"> | |
<router-view></router-view> | |
</div> | |
</template> |
This file contains 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 class App { | |
configureRouter(config, router) { | |
config.title = 'Aurelia'; | |
config.map([ | |
{ route: ['', 'page1'], name: 'welcome', moduleId: 'page1', nav: true, title: 'Welcome' } | |
]); | |
this.router = router; | |
} | |
} |
This file contains 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"> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"></link> | |
</head> | |
<body aurelia-app="main"> | |
<h1>Loading...</h1> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.6/system.js"></script> | |
<script src="https://rawgit.com/aurelia-ui-toolkits/aurelia-kendoui-bundles/0.3.15/config2.js"></script> | |
<script> | |
System.import('aurelia-bootstrapper'); | |
</script> | |
</body> | |
</html> |
This file contains 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 'bootstrap'; | |
export function configure(aurelia) { | |
aurelia.use | |
.standardConfiguration() | |
.developmentLogging(); | |
aurelia.start().then(() => aurelia.setRoot()); | |
} |
This file contains 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> | |
<div>This is the test element - is "choices" undefined: ${ valueIsUndefined }</div> | |
<input value.bind="value"></input> | |
</template> |
This file contains 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, inject} from 'aurelia-framework'; | |
import {BindingEngine} from 'aurelia-binding'; // or from 'aurelia-framework' | |
@inject(BindingEngine) | |
export class MyElement { | |
@bindable choices = []; | |
@bindable value = ""; | |
subscription; | |
bindingEngine; | |
constructor(bindingEngine) { | |
this.bindingEngine= bindingEngine; | |
console.log(this.choices); | |
} | |
attached() { | |
console.log(this.choices); | |
if(!this.choices) { | |
this.choices = []; | |
this.choices.push('aaa'); | |
} | |
} | |
choicesChanged(newValue) { | |
if(this.subscription) { | |
this.subscription.dispose(); | |
} | |
if(newValue) { | |
this.subscription = this.bindingEngine.collectionObserver(this.choices) | |
.subscribe(this.arrayChanged.bind(this)); | |
} | |
} | |
valueChanged(newValue) { | |
this.choices.push(newValue); | |
} | |
arrayChanged(splices) { | |
console.log(this.choices); | |
} | |
} |
This file contains 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> | |
<require from="my-element"></require> | |
<section class="au-animate"> | |
<h2>Test Page</h2> | |
<my-element choices.two-way="form.choices"></my-element> | |
<button click.delegate="printChoices()">printChoices</button> | |
</section> | |
</template> |
This file contains 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 class Page1 { | |
form = {}; | |
printChoices(){ | |
console.log(this.form.choices); | |
} | |
} |
This file contains 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
console.log('Hello World!'); |
This file contains 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
/* todo: add styles */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment