-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_component.dart
30 lines (27 loc) · 1000 Bytes
/
app_component.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import 'package:angular/angular.dart';
import 'package:myapp/src/directive_my_dummy.dart';
import 'package:myapp/src/directive_my_repeater.dart';
import 'package:myapp/src/directive_my_detector.dart';
import 'package:myapp/src/repeater.dart';
@Component(
selector: 'app-component',
templateUrl: 'app_component.html',
directives: [MyDetectorDirective, MyDummyDirective, MyRepeaterDirective]
)
class AppComponent implements OnInit {
// The repeater is used to periodically change the values of some exported
// properties.
Repeater _r = Repeater(30, 1);
// Properties that will be visible within the component template.
static const List<String> colors = ['red', 'green', 'blue'];
int index = 0;
String color = colors[0];
int listElementCount = 6;
void ngOnInit() {
_r.go(() {
listElementCount = 6 == listElementCount ? 3 : 6;
index = (index + 1) % colors.length;
color = colors[index];
});
}
}