angularfs icon indicating copy to clipboard operation
angularfs copied to clipboard

Didn't get output from Angular cloud Firestore using routerLink

Open rijomonr opened this issue 8 years ago • 4 comments

https://stackoverflow.com/questions/47149153/didnt-get-output-from-angular-cloud-firestore-using-routerlink

rijomonr avatar Nov 07 '17 02:11 rijomonr

Any suggestion? When I go back, from an add form the list disappear

Thanks

sggonzalezg avatar Nov 23 '17 20:11 sggonzalezg

Hi, This setup has helped me out, so thanks. I also trying to add a router arrangement with home '/' page that navigates to '/items' where the list is. Works the first time, then navigating back to home '/' and back into '/items', the list does not re-appear, just displays the "There are no items...'.

Not sure where to look.

rangiesrule avatar Nov 23 '17 22:11 rangiesrule

Hi @rangiesrule, did you resolve this issue? I have the same problem right now and I think is related to the async pipe that is not called in the *ngFor. when I add the async no items are displayed at all not even at the first time loading, and the error is the following one:

ItemsComponent.html:9 ERROR Error: InvalidPipeArgument: '[object Object],[object Object],[object Object],[object Object],[object Object]' for pipe 'AsyncPipe'

Probably the error it's in the item component when the item service is called and is subscribed to getItems() inside ngOnInit()

Rugleh avatar Dec 06 '17 06:12 Rugleh

I don't know if this is the best way but I unsubscribed from the itemService in ngOnDestroy... so roughly this in the item component..

export class ItemsComponent implements OnInit, OnDestroy { ..... subscribedData: Subscription; }

ngOnInit() { this.subscribedData = this.itemService.getItems().subscribe(items ..... .... }

ngOnDestroy(): void { this.subscribedData.unsubscribe(); }

After doing this the data reloads on routerLink navigation...

chris-cli avatar Apr 12 '18 22:04 chris-cli