Closed Jai-Krish closed 6 years ago
@Jai-Krish you are using ObservableArray from NativeScript core modules along with RxObservable from rxjs
. I would suggest using only one of the concepts preferably the Angular one (Rxjs) entirely in your implementation. You can also directly create the async pipe for your items source instead of using structural directive depending no the same asynchronous source. Example of async pipe with RxObservable source can be found here
@NickIliev As shown in the example, I've converted the items
into Observable<Array<Observable<Item>>>
and also changed the template into <ListView [items]="items$ | async" class="list-group">
but still it just shows the empty Label
s without any text in it. Since I'm fetching these items from a real time database, I definitely need to listen to them individually for changes thats why every item
is being served from an Observable
.
<ListView [items]="groceryList" row="0" class="small-spacing" [class.visible]="listLoaded" >
<ng-template let-item="item">
<StackLayout orientation="horizontal" (longPress)="itemSelect(item)" >
<CheckBox width="40" #CB1 [checked]="item.isSelected" class="medium-spacing" visibility="{{isCheckBoxVisible === 'visible' ?'visible' : 'collapsed' }}"></CheckBox>
<Image width="40" class="medium-spacing" visibility="{{isImageVisible === 'visible' ?'visible' : 'collapsed' }}"></Image>
<Label width="40" [text]="item.custName" class="medium-spacing" ></Label>
</StackLayout>
</ng-template>
</ListView>
itemSelect(item:Order){
this.isCheckBoxVisible = 'collapsed';
this.isImageVisible = 'visible';
}
Checkbox and Image visibility is not binding for me as well.
@nmongiya are you still experiencing this issue? Let me know and log a new separate issue if you have project to reproduce this behavior with the latest tns-core-modules and nativescript-angular.
I have a view with a list of items fetched from the variable
items
which is of typeObservableArray<Observable<item>>
Here, the
ng-template
gets generated but the contents inside the template doesn't showup. I can verify that theitem
Observable gets subscribed by adding a log before theObserver.next
of thatObservable
.What should I do to get this right?
Here is the minimal project: ListBinding.zip