Skip to content

Instantly share code, notes, and snippets.

@gossi
Last active May 30, 2020 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gossi/c965eb18b7f6938726fd5333caa87d4e to your computer and use it in GitHub Desktop.
Save gossi/c965eb18b7f6938726fd5333caa87d4e to your computer and use it in GitHub Desktop.
no-controller
import Route from '@ember/routing/route';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class ApplicationRoute extends Route {
@tracked foo = 'foo';
get bar() {
return `${this.foo} bar`;
}
model() {
return {
foo: this.foo,
bar: this.bar,
helloWorld: this.helloWorld,
updateFoo: this.updateFoo
};
}
@action
updateFoo(event) {
this.foo = event.target.value;
}
@action
helloWorld() {
console.log('hello world:', this.bar);
}
}
<h1>Welcome to {{@model.foo}}</h1>
<br>
<input value="{{@model.foo}}" {{on "input" @model.updateFoo}}>
<br>
{{@model.bar}}
{{outlet}}
<br>
<button {{on "click" @model.helloWorld}}>Say hello</button>
<br>
{
"version": "0.17.1",
"EmberENV": {
"FEATURES": {},
"_TEMPLATE_ONLY_GLIMMER_COMPONENTS": false,
"_APPLICATION_TEMPLATE_WRAPPER": true,
"_JQUERY_INTEGRATION": true
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"ember": "3.18.1",
"ember-template-compiler": "3.18.1",
"ember-testing": "3.18.1"
},
"addons": {
"@glimmer/component": "1.0.0",
"ember-simple-set-helper": "0.1.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment