I have a demo controller:
import Ember from 'ember';
export default Ember.Controller.extend({
firstName: 'Bob',
lastName: 'Smith',
emailAddress: '[email protected]',
fullName: Ember.computed('firstName', 'lastName', function() {
console.log('executed!');
return `${this.get('firstName')} ${this.get('lastName')}`;
}),
actualEmailAddress: Ember.computed('emailAddress', function() {
console.log('actualEmailAddress function is called: ', this.get('emailAddress'));
})
});
When I'm running the app on localhost in the browser, I open ember inspector and run:
$E.get('actualEmailAddress')
This returns:
actualEmailAddress function is called: [email protected]
But when I run it a second time I just get undefined
Same thing when I run $E.get('fullName')
It returns
executed!
"Bob Smith"
But then when I run it again it only returns Bob Smith
, not the console.log
Why is this happening?
Thank you!