Cannot use computed properties in node.js
See original GitHub issuerequire('ember-metal');
require('ember-runtime');
const EmberObject = Ember.Object;
const computed = Ember.computed;
const User = EmberObject.extend({
firstName: 'Izel',
lastName: 'Nakri',
fullName: computed('firstName', 'lastName', function() {
return `${this.get('firstName')} ${this.get('lastName')}`;
})
});
let me = User.create();
console.log(me.get('firstName')); // works prints 'Izel'
console.log(me.get('lastName')); // works prints 'Nakri'
console.log(me.get('fullName')); // !! CRASHES: TypeError: this.func.call is not a function
// Stacktrace:
// at ComputedProperty.Cp.get (..myproject../node_modules/ember-metal/ember-metal.js:3738:21)
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Can't use computed property in data - Stack Overflow
I want to pass the return value of the someCheck computed property into the disabled value in the data but in the ProgressContent...
Read more >computed-properties - npm
Start using computed-properties in your project by running `npm i computed-properties`. There are no other projects in the npm registry ...
Read more >Object initializer - JavaScript - MDN Web Docs - Mozilla
Computed property names are not allowed either. JSON object property values can only be strings, numbers, true , false , null , arrays,...
Read more >Computed Properties | Docs - Ractive
The idea is fairly simple: you can define computed properties that update reactively based on their dependencies. In previous versions you may have...
Read more >[Solved]-Can't use computed property in data-Vue.js
You can't assign a computed to a data property while the data is initializing. Even if you could, it would not be reactive,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@k3n use
const Ember = require('ember-source/dist/ember.debug');
and then tryObject.keys(Ember)
and then donew Ember.Object
If you did
2 === require('ember-source/dist/ember.debug')
it would be false.Also, the inspect issue is fixed in canary https://github.com/emberjs/ember.js/blob/3a7fd70ace89286eb192897d57d61ab4e0603fa6/packages/ember-utils/lib/inspect.ts#L29-L30
https://nodejs.org/api/util.html#util_custom_inspection_functions_on_objects
@izelnakri @k3n @krisselden @rwjblue is this still an issue, perhaps we should close, what do you think?