Skip to content

Instantly share code, notes, and snippets.

@luxzeitlos
Created September 15, 2021 11:55
Show Gist options
  • Save luxzeitlos/e89a9c7ed35a9542c6fc8b759375cb1b to your computer and use it in GitHub Desktop.
Save luxzeitlos/e89a9c7ed35a9542c6fc8b759375cb1b to your computer and use it in GitHub Desktop.
New Twiddle
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class ApplicationController extends Controller {
@tracked valid = false;
@tracked value = false;
get trueVal() {
return this.valid && this.value;
}
get notVal() {
return this.valid && !this.value;
}
@action
setVal(val) {
this.valid = true;
this.value = val;
}
}
<input type="radio" name="drone" value="true" checked={{this.val}} {{on "click" (fn this.setVal true)}}>TRUE
<input type="radio" name="drone" value="false" checked={{this.notVal}} {{on "click" (fn this.setVal false)}}>FALSE<br>
VALUE:{{this.value}}<br>
VALID:{{this.valid}}
{
"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": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.js",
"ember": "3.18.1",
"ember-template-compiler": "3.18.1",
"ember-testing": "3.18.1"
},
"addons": {
"@glimmer/component": "1.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment