Last active
March 14, 2025 12:33
-
-
Save lifeart/bae9506b5431123ddc34b78095771f9c to your computer and use it in GitHub Desktop.
demo for https://ember-twiddle.com/
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 Controller from '@ember/controller'; | |
import { inject as service } from '@ember/service'; | |
import { action, notifyPropertyChange, set, computed } from '@ember/object'; | |
export default class ApplicationController extends Controller { | |
appName = 'Ember Twiddle'; | |
@service state; | |
@action update() { | |
set(this.state, 'value', `${this.state.value}:${this.state.value}`); | |
//this.state.value = `${this.state.value}:${this.state.value}`; | |
//notifyPropertyChange(this.state, 'value'); | |
notifyPropertyChange(this.state, 'name'); | |
//notifyPropertyChange(this, 'valueGetter'); | |
//notifyPropertyChange(this, 'nameGetter'); | |
notifyPropertyChange(this, 'nameComputed'); | |
} | |
@computed | |
get nameComputed() { | |
return this.state.name; | |
} | |
get valueGetter() { | |
return this.state.value; | |
} | |
get nameGetter() { | |
return this.state.name; | |
} | |
} |
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 Service from '@ember/service'; | |
import { computed } from '@ember/object'; | |
export default Service.extend({ | |
value: '123', | |
name: computed(function(){ | |
return this.value; | |
}), | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment