Struggling with Angular 2 and Immutable JS - having issues with a simple for-loop in my template. Tried both old and new syntax without success.
<div *ngFor='#filter of filterArray' class='filter-row'>
<div class='row-title'>{{filter.get(title)}}</div>
</div>
and the new syntax
<div *ngFor=' let filter of filterArray' class='filter-row'>
<div class='row-title'>{{filter.get(title)}}</div>
</div>
Struggled using .get syntax for immutable maps in curly braces, unable to make it work.
Structure of filterArray:
this.filterArray = fromJS([{
title: 'Brand',
},
{
title: 'Category'
},
{
title: 'Each UPC'
}]);
Any special syntax needed for this to work? Not displaying anything on browser, no errors with let syntax.
Versions:
"@angular/common": "^2.1.0",
"@angular/compiler": "^2.1.0",
"@angular/core": "^2.1.0",
"@angular/forms": "^2.1.0",
"@angular/http": "^2.1.0",
"@angular/platform-browser": "^2.1.0",
"@angular/platform-browser-dynamic": "^2.1.0",
"@angular/router": "^3.0.1",
"immutable": "^3.8.1",
"typescript": "2.0.2"
Tried this workaround but not satisfied with how it looks:
<div *ngFor='let filter of filterArray let i=index' class='filter-row'>
<div class='row-title'>{{filterArray.get(i).get('title')}}</div>
</div>