You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 22, 2018. It is now read-only.
Consider the simple HTML test file below with a single line ctrl.list = {{ ctrl.list }} and a very small controller exporting List get list => new List.generate(3, (i) => i).
Run under Angular 0.9.8 it yields:
ctrl.list = [0, 1, 2]
Run under Angular from git yields the same output but with
Exception: Observer reaction functions should not change model.
These watch changes were detected: ctrl.list: [0, 1, 2] <= [0, 1, 2]; [[ctrl.list = {{ ctrl.list }}]](ctrl.list): [[0, 1, 2]] <= [[0, 1, 2]]
These observe changes were detected: (package:angular/core/scope.dart:521)
My guess is that this is related to the new change detection algorithm. Is this the next expected behavior?
<!DOCTYPE html>
<html>
<head>
<title>Angular test</title>
</head>
<body test>
<p>ctrl.list = {{ ctrl.list }}</p>
<script type="application/dart">
import 'package:angular/angular.dart';
void main() { ngBootstrap(module: new Module()..type(MyController)); }
@NgController(publishAs: 'ctrl', selector: '[test]')
class MyController {
List get list => new List.generate(3, (i) => i);
}
</script>
<script src="packages/browser/dart.js"></script>
</body>
</html>
The text was updated successfully, but these errors were encountered:
Yes, under the new change detection this is not allowed. The list getter returns a new list every time and produces a lot of garbage. This pattern is detrimental to application performance.
@pavelgj or @mhevery : could you point me to a fully worked out example of the approach you promote above (using MyService etc)? Maybe a test case? Thanks.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Consider the simple HTML test file below with a single line
ctrl.list = {{ ctrl.list }}
and a very small controller exportingList get list => new List.generate(3, (i) => i)
.Run under Angular 0.9.8 it yields:
Run under Angular from git yields the same output but with
My guess is that this is related to the new change detection algorithm.
Is this the next expected behavior?
The text was updated successfully, but these errors were encountered: