Im a newbie in angular 2. Im trying to avoid *ngFor loop coz I think it has problems with IE9 which is the minimum requirement for my project. I remember in ReactJS you can store elements/component inside a variable. Is this possible in Angular 2?
Asked
Active
Viewed 623 times
1 Answers
0
If you go to https://github.com/angular/angular you can check that Angular2 supports IE9, so you shouldn't have any issues.
Asking your question:
- DOM Elements:
ElementRef
class - Components:
ComponentRef<T>
generic class
You have to use the following decorators to access the element/component in your template:
- ViewChild/ViewChildren
- ContentChild/ContentChildren
Check this to see the difference between ViewChild & ContentChild https://stackoverflow.com/a/34327754/6771029
Here is how to use the @ViewChild
decorator https://angular.io/docs/ts/latest/api/core/index/ViewChild-decorator.html