Git Product home page Git Product logo

Comments (13)

EddyVerbruggen avatar EddyVerbruggen commented on September 25, 2024 3

@triniwiz I wouldn't fix anything for anyone shouting "ASAP" at me.

from nativescript-pager.

mpochron avatar mpochron commented on September 25, 2024 1

After upgrading to the latest works! thanks :D

from nativescript-pager.

sean-perkins avatar sean-perkins commented on September 25, 2024

What does your items collection look like? How is that observable collection populated?

We use this plugin in a lazy-loaded module without those listed problems (iOS and Android).

from nativescript-pager.

mpochron avatar mpochron commented on September 25, 2024

with using an attribute async , that would be component:

export class DummyComponent {
items: any;

    constructor() {
        this.items = new BehaviorSubject([
            {
                title: "Slide 1",
                image: "~/images/Hulk_(comics_character).png"
            },
            {
                title: "Slide 2",
                image: "https://s-media-cache-ak0.pinimg.com/originals/4c/92/cc/4c92cc1dfbde6a6a40fe799f56fa9294.jpg"
            }])
   }

}

or without attribute async maybe items with items:any = [{id:0}, {id: 1}];

fine works without loadChildren inside routing, i dont know how to implement this pluginin mode lazy, becaseu it's generating error Cannot read property 'nativeView' of null

from nativescript-pager.

sean-perkins avatar sean-perkins commented on September 25, 2024

Perhaps try moving the items instantiation to an ngOnInit life-cycle hook.

Our implementation is like:

 <Pager [items]="banners$ | async" (selectedIndexChange)="onIndexChanged($event)" #bannerEl>
        <ng-template pagerItemTemplate let-banner="item" let-i="index">
            <GridLayout paddingLeft="10" paddingRight="10">
                <loop-banner [banner]="banner" [expanded]="bannerExpanded"></loop-banner>
            </GridLayout>
        </ng-template>
    </Pager>

where banners$ is an observable subscription to ngrx state:

this.banners$ = this.store$.select(getBanners);

This lives in our DashboardComponent, which is part of a lazy-loaded module:

 {
                path: 'dashboard',
                children: [
                    { path: '', pathMatch: 'full', redirectTo: 'user' },
                    {
                        path: 'user',
                        loadChildren:
                            './+dashboard-user/dashboard-user.module#DashboardUserModule'
                    }
                ]
            },

from nativescript-pager.

mpochron avatar mpochron commented on September 25, 2024

Sorry, it doesn't solve my problem.

from nativescript-pager.

triniwiz avatar triniwiz commented on September 25, 2024

@mpochron still receiving the same error after upgrading to the latest ?

from nativescript-pager.

mpochron avatar mpochron commented on September 25, 2024

@triniwiz ..

I am back...

    <Pager [items]="items | async" #pager [selectedIndex]="currentPagerIndex" (selectedIndexChange)="onIndexChanged($event)" class="pager">
        <ng-template pagerItemTemplate let-i="index" let-item="item">
            <GridLayout class="pager-item" rows="auto, *" columns="*" backgroundColor="red">
                <Label [text]="'TEST'"></Label>
            </GridLayout>
        </ng-template>
    </Pager>

But each row keeps to print "[object Object]" ? Why?

from nativescript-pager.

mpochron avatar mpochron commented on September 25, 2024

@triniwiz

image

import { NgModule } from "@angular/core";
import { NativeScriptRouterModule } from "nativescript-angular/router";
import { Routes } from "@angular/router";

import { TestComponent } from "./test/test.component";
import { TestMultiComponent } from './test-multi/test-multi.component';
import { DummyComponent } from "./dummy.component";

const routes: Routes = [
  { path: '', redirectTo: '/test', pathMatch: 'full' },
  { path: 'test', component: TestComponent },
  { path: 'multi', component: TestMultiComponent },
  { 
    path: 'dummy', 
    loadChildren: "./dummy/dummy.modules#DummyModule",
  }
];

@NgModule({
    imports: [NativeScriptRouterModule.forRoot(routes)],
    exports: [NativeScriptRouterModule]
})
export class AppRoutingModule { }

After using loadChildren still keeps to show [object Object], but sliding works. Please ASAP fix it.

from nativescript-pager.

triniwiz avatar triniwiz commented on September 25, 2024

A work around you can try is getting the pager instance then call pagerInstance.reload(true)

from nativescript-pager.

mpochron avatar mpochron commented on September 25, 2024

Oh found bug.

            <Pager [items]="contacts | async" #pager class="pager" showNativePageIndicator="true">
                <ng-template pagerItemTemplate let-i="index" let-item="item">
         <StackLayout>

                        <Label *ngFor="let contact of item" [text]="contact.firstName"></Label>

                    </StackLayout>
                </ng-template>
            </Pager>

From the beginning method ngFor was the reason. Without ngFor well works. Any idea how to fix and use ngFor in that situation?

from nativescript-pager.

triniwiz avatar triniwiz commented on September 25, 2024

You can try upgrading

from nativescript-pager.

mpochron avatar mpochron commented on September 25, 2024

But thanks, i found other answer thanks to creating custom component where can have ngFor.

from nativescript-pager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.