Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Render ngFor after http call #316

Closed
Closed

Description

@joaogarin

Hello,

I have a component rendering a ngFor with data coming from an Http request. The http request works fine after the latest changes (beta8 and latest of universal-preview) and the data is received corectly.

However it does not copy it to the template. Very similar to what is done here https://angular.io/docs/ts/latest/guide/server-communication.html with the heroes example. Is there something specific that needs to be done so that the ngFor actually prints the data into the template with Universal?

Best regards
Joao Garin

Activity

  1. PatrickJS commented on Mar 9, 2016

    @PatrickJS
    Contributor

    we're working on adding this back

  2. PatrickJS commented on Mar 9, 2016

    @PatrickJS
    Contributor

    closing for this issue you can track #274

  3. joaogarin commented on Mar 10, 2016

    @joaogarin
    Author

    Thanks;)

  4. joaogarin commented on Mar 20, 2016

    @joaogarin
    Author

    Hello,

    I am still getting this problem with latest version.

    #274 seems to be resolve but in my app it looks like the client side is never really picked up.

    My repo is https://github.com/joaogarin/myblog-angular2, the HTTP calls do seem okay as I can log and see that I receive a response but in the client nothing is really rendered.

  5. PatrickJS commented on Mar 21, 2016

    @PatrickJS
    Contributor

    @wellingWilliam I'll fix the https issue and look into |async you can track the http issue at #326

  6. PatrickJS commented on Mar 21, 2016

    @PatrickJS
    Contributor

    @wellingWilliam can you create an issue about the preboot error?

  7. joaogarin commented on Mar 21, 2016

    @joaogarin
    Author

    Using

    providers: [ provide(APP_BASE_HREF, { useValue: baseUrl }), provide(REQUEST_URL, { useValue: url }), ROUTER_PROVIDERS, NODE_LOCATION_PROVIDERS, NODE_PRELOAD_CACHE_HTTP_PROVIDERS ], async: true, preboot: true, precache: true,

    I can get it to render on the template. But still my client side app does not actually kick in and I think that might be the issue with preboot.

    Should NODE_PRELOAD_CACHE_HTTP_PROVIDERS or NODE_HTTP_PROVIDERS by used for http requests?

  8. PatrickJS commented on Mar 21, 2016

    @PatrickJS
    Contributor

    I'm going to replace NODE_PRELOAD_CACHE_HTTP_PROVIDERS with NODE_HTTP_PROVIDERS soon so for now use NODE_PRELOAD_CACHE_HTTP_PROVIDERS.

    @joaogarin on the client you need to tell preboot to complete and swap the views

    import {prebootComplete} from 'angular2-universal-preview'
    import {bootstrap} from 'angular2/core';
    
    import {App} from './src/app/app';
    
    bootstrap(App).then(prebootComplete);
  9. joaogarin commented on Mar 21, 2016

    @joaogarin
    Author
    import 'angular2-universal-preview/polyfills';
    import {prebootComplete} from 'angular2-universal-preview';
    
    import {bootstrap} from 'angular2/platform/browser';
    import {ROUTER_PROVIDERS} from 'angular2/router';
    import {HTTP_PROVIDERS} from 'angular2/http';
    
    import {App} from './app/app';
    
    bootstrap(App, [
        ...ROUTER_PROVIDERS,
        ...HTTP_PROVIDERS
    ])
    .then(prebootComplete);

    This is how my client looks like. I am debugging now and it get in the start() method of preboot_browser with what looks to be the correct dom representation. Trying to figure it out.
    tks

  10. 5 remaining items

  11. lngr commented on Mar 21, 2016

    @lngr

    @joaogarin thanks, I thought that this only referred to manipulation via element.nativeElement.style = "font-weight: bold". Butimg src` is also mentioned. I'll take a closer look.

  12. PatrickJS commented on Mar 22, 2016

    @PatrickJS
    Contributor

    @wellingWilliam can you create a new issue about async child routes with routerLink

  13. PatrickJS commented on Mar 22, 2016

    @PatrickJS
    Contributor

    @lngr can you create another issue about src="{{ url }}"

  14. lngr commented on Mar 23, 2016

    @lngr
  15. jeffwhelpley commented on May 6, 2016

    @jeffwhelpley
    Contributor

    So, it seems like there are 3 or 4 different issues here. #330 has a PR pending in core so we are just waiting for that. #331 is fixed. Some of the preboot issues mentioned are fixed. It seems like this issue is resolved, but please comment here if any of you on this issue think differently after getting the latest and re-testing.

  16. cyrilletuzi commented on Sep 16, 2016

    @cyrilletuzi
    Contributor

    Same issue with the very last version of Universal (2.0.4). Static contents are well rendered by Universal, but async content retrieved by Http calls are not rendered. Http calls work and get the data, but as the operation is async, rendering has already been done (verified by checking ngAfterViewInit).

  17. jeffwhelpley commented on Sep 16, 2016

    @jeffwhelpley
    Contributor

    @cyrilletuzi if you are saying data retrieved from http calls are not displayed, then it must be due to issues with the zone patch. Can you post your code where the http calls are being made and your bootstrap code? cc @gdi2290

  18. cyrilletuzi commented on Sep 16, 2016

    @cyrilletuzi
    Contributor

    @jeffwhelpley Thanks for the tip. With Universal 2.0.3 I needed to go back to zone.js 0.6.21 as there was an error with the last 0.6.23 zone.js, but it works now with Universal 2.0.4. Universal package.json should be updated consequently (can do a PR but for such a small change I think it's quicker to be done by a member).

  19. angular-automatic-lock-bot commented on Sep 4, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  20. locked and limited conversation to collaborators on Sep 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions