-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Hi @rajivnarayana,
I'm trying to implement this plugin with Angular, however, I'm struggling to register the custom <itemTemplate> and the <headerTemplate>.
The only thing missing is customising the template which by default, is showing: [object Object].
I know in A{N} I have to create my item using let-item, but let doesn't work with any other element besides <template>:
ERROR
"let-" is only supported on template elements. ("
<SectionedListView [items]="sectionedArray" rowHeight="44">
<itemTemplate [ERROR ->]let-item="item">
<Label [text]="item.name"></Label>
</itemTemplate>
"): SectionedListViewComponent@4:26Do you know how does work?
MY CODE:
import {Component} from '@angular/core';
import {registerElement} from "nativescript-angular/element-registry";
var observableSectionArrayModule = require("observable-sectioned-array");
registerElement('SectionedListView', () => require("nativescript-sectioned-list-view").SectionedListView);
@Component({
selector: 'core-sectioned-listview',
template: `
<SectionedListView [items]="sectionedArray" rowHeight="44">
<itemTemplate let-item="item">
<Label [text]="item.name"></Label>
</itemTemplate >
<headerTemplate>
<Label [text]="$value"></Label>
</headerTemplate>
</SectionedListView>
`,
})
export class CoreSectionedListView {
items: any;
sectionedArray: any;
constructor() {
this.items = [
{"name" : "Alice", gender:"female"},
{"name": "Adam", gender: "male"},
{"name": "Bob", gender: "male"},
{"name": "Brittany", gender: "female"},
{"name": "Evan", gender: "male"}
];
var boys = this.items.filter(function(student) { return student.gender ==="male";});
var girls = this.items.filter(function(student) { return student.gender ==="female";});
this.sectionedArray = new observableSectionArrayModule.ObservableSectionArray();
this.sectionedArray.addSection("Boys", boys);
this.sectionedArray.addSection("Girls", girls);
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
