-
Notifications
You must be signed in to change notification settings - Fork 27k
Closed as not planned
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimecore: change detectionneeds: discussionIndicates than an issue is an open discussionIndicates than an issue is an open discussion
Milestone
Description
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
There is no real computed properties. Getters are bad for performance. Example https://plnkr.co/edit/TQMQFb?p=preview
Expected behavior
To be able to use computed properties as in vue or mobx
What is the motivation / use case for changing the behavior?
My proposal is to make change detection smarter by adding computed properties like in mobx or vue.
import {Computed, Reactive} from '@angular/core';
...
class MyCmp {
age = 69;
@Reactive firstName = 'hello';
@Reactive lastName = 'angular';
@Computed get fullName() {
console.log('recomputed');
return `${this.firstName} ${this.lastName}`;
}
}This will allow to have computed get property and be able to cache it, so it is computed only when needed. Currently this is not possible and getter is recomputed a lot of times, especially if using default change detection.
camsteffen, njulhb, 555ea, tsugitta, abdel-ships-it and 62 morecleever, alyssamichelle, magedhennawy, MBuchalik, theoklitosBam7 and 2 moreMIZUDINOV
Metadata
Metadata
Assignees
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimecore: change detectionneeds: discussionIndicates than an issue is an open discussionIndicates than an issue is an open discussion