Angular Vienna, Server Side Rendering and Pre Rendering with Angular Universal, July 2019

Поделиться
HTML-код
  • Опубликовано: 16 янв 2025

Комментарии • 58

  • @soniar4i
    @soniar4i 5 лет назад

    You last couple of minutes about lazy loading in server are gold, I, of course, forgot to add that. Thanks a lot :)

    • @ferdinandmalcher7434
      @ferdinandmalcher7434 4 года назад +1

      Please be aware that this is not necessary anymore with Angular 9 and Ivy 🙂

    • @chicagoboy279
      @chicagoboy279 4 года назад

      @@ferdinandmalcher7434 how to apply ssr in angular 9?

    • @ferdinandmalcher
      @ferdinandmalcher 4 года назад

      @@chicagoboy279 The same way I showed in the video. ng add and then use the provided NPM scripts.

    • @junaidamjad3510
      @junaidamjad3510 4 года назад

      @@ferdinandmalcher how to apply it on a specific route in our application?

  • @junaidamjad3510
    @junaidamjad3510 4 года назад +3

    can we do ssr on a specific route?

  • @dp5050
    @dp5050 4 года назад +1

    Hi Ferdinand, Its a serious matter here! I've been working on SSR since 30+ days, and still stuck on somewhere.
    Actually I'm working on an angular project where all the DOM operations, localStorage, sessionStorage, cookeis etc. are widely used. But for SEO purpose and Social Platform sharing, I need to update meta tags dynamically, which is only possible by using SSR. So I've implemented this, I got a lot of errors and challenges but I've resolved all those one by one. Even for lazy loading with http calls server was not working fine, then I changed it by switching the platformbrowser. Now project is running with SSR and seems ok with existing functionalities. But what I saw, if I see view source of the page there's not all rendered html showing up inside ... .
    And also there, meta tags are not dynamically added as per page needed.
    I've figured out something, its making all http requests at platformbrowser, and not updating meta tags dynamically.
    Finally I'm lost and confused. So plz help me out step by step to achieve this SSR stuff.

  • @SameeraSenarathna
    @SameeraSenarathna 3 года назад

    Great Explanation on Angular Universal. Thanks for Sharing 💖

  • @stevemurch3245
    @stevemurch3245 4 года назад +1

    Really clear, beautifully explained.

  • @rogervanwile
    @rogervanwile 5 лет назад +1

    Great talk, helped me a lot! Thanks for sharing!

  • @ShaikhShariq
    @ShaikhShariq 4 года назад +2

    It was quite interesting talk and very useful. It was good I chose to go though this rather than boring documentation. If you might have covered or pointed out any resource on how we can differentiate between bot request and actual user request to redirect request to express server.

    • @ferdinandmalcher7434
      @ferdinandmalcher7434 4 года назад +1

      To difefrentiate between bot and actual user you need to analyze the user agent string from the request. You should use a useragent parser for this, of course, like this one: www.npmjs.com/package/useragent

    • @ShaikhShariq
      @ShaikhShariq 4 года назад

      @@ferdinandmalcher7434 Thank you, just wanted to know that there is nothing fancy to be done after the server and client files generation. I need to setup my web server to redirect based on useragent string to node server or the actual server hosting client site.

    • @ferdinandmalcher7434
      @ferdinandmalcher7434 4 года назад

      @@ShaikhShariq Yep, there is no built-in mechanism to determine the user agent. The Node.js server is the only instance that can read the useragent from the request. If you want to pass this to the application (e.g. to not render some parts for a bot) you can provide that information via the "providers" array within the ngExpressEngine.

    • @ShaikhShariq
      @ShaikhShariq 4 года назад

      @@ferdinandmalcher7434 I do have my main server as apache, which will host client site and additional node express server I will configure to host site for bots. Does this sound correct ?

  • @sangeethajothiprakash2295
    @sangeethajothiprakash2295 3 года назад

    I am unable to compile it is not generating server.js file what to do sir

  • @mirnahaddad5227
    @mirnahaddad5227 4 года назад +1

    need help, I am using angular 10, when I applied the angular universal SSR and pre-rendering, but I got window is not defined I tried all the ways by injecting it and use it globally , and by use isPlatformBrowser but nothing solve the problem , i need to know how i can know the root cause of the problem in order to know what's the solution for it , Thank you :)

  • @creativa5140
    @creativa5140 5 лет назад +2

    prerender not load

  • @chandansingh9742
    @chandansingh9742 5 лет назад +1

    Hi Ferdinand, this is very helpful, thanks. quick question, how can we trigger the node backend rendering from a Java/spring based platform. Any link you can share?

    • @ferdinandmalcher7434
      @ferdinandmalcher7434 4 года назад

      In fact I never did this before... here's two links that might help:
      github.com/angular/universal/issues/280
      github.com/swaechter/angularj-universal

  • @rodolfonogueira7254
    @rodolfonogueira7254 5 лет назад +2

    Brilhant talk!!

  • @horaciosoldman1569
    @horaciosoldman1569 5 лет назад +1

    Thank you Ferdinand :)

  • @adeebspace7460
    @adeebspace7460 2 года назад

    Hi Ferdinand, Good explanation. I was trying to implement CSR and SSR in my application. But i was not clear how to move forward. Could you please provide any sample code where few components as client side rendering and few components as server side rendering. (Tried Hybrid approach but i was not clear about it).
    It would be the great help. Thanks in Advance

  • @09sangram
    @09sangram 4 года назад

    Great talk. Thank you for the tutorial

  • @ankithas1868
    @ankithas1868 4 года назад

    Superb talk

  • @Mr.Naguib
    @Mr.Naguib 5 лет назад +2

    I want to like that 100 times

  • @ubaidiftikhar1220
    @ubaidiftikhar1220 4 года назад

    Hi,
    Did the prerendered with: ng run App:prerender
    and then Server that app for SSR with: node dist/app/server/main.js
    But not getting the statics routes as pre-rendered. Any help on this
    Thanks in Advance

  • @nahidmorady3023
    @nahidmorady3023 4 года назад

    thanks for sharing, It was very practical

  • @offir711
    @offir711 3 года назад

    Wouldn't it be just faster and easier to use wordpress instead?

  • @hernanangular8124
    @hernanangular8124 3 года назад

    Thanks you very much, good job!!

  • @Pranavk-tc5sc
    @Pranavk-tc5sc 10 месяцев назад

    so I doubt this after 4 years😂. because now I gonna implement this. The thing is that if I use Django as the back end, is it mandatory to use the express engine?

  • @FMAlmeidaLeite
    @FMAlmeidaLeite 3 года назад

    Me ajudou muito! Obrigado!

  • @ЮрийЛесников-е9й
    @ЮрийЛесников-е9й 5 лет назад

    Hello! I tried to add prerender technic into my Angular 8 Universal application (29:07 timeline in the video), but I caught an error. Can anybody help me?
    node dist/prerender
    ERROR TypeError: Cannot read property 'load' of undefined

  • @venkateshg3236
    @venkateshg3236 5 лет назад

    Can we use this in ionic Project

  • @kanyewest1503
    @kanyewest1503 5 лет назад +1

    My project on angular 8 compile successfully with npm run compile:server. But when i tried it run it with command node dist/server it shows me an error like "ReferenceError: window is not defined". Can anyone help me!

    • @ferdinandmalcher7434
      @ferdinandmalcher7434 4 года назад

      I did not mention this in the talk but: You can not use the "window" object in your code on the server because there is just a DOM emulation, no real DOM. You need to create a platform switch and ignore the code that uses window when the app runs on the server. You can use the functions "isPlatformBrowser()" and "isPlatformServer()" for this.

  • @iFootballBR
    @iFootballBR 5 лет назад +2

    You save my life!

  • @lordmidi9202
    @lordmidi9202 4 года назад

    good overview

  • @shireeshkumar5319
    @shireeshkumar5319 5 лет назад +6

    crazy talk. was expecting lot of claps. :D

  • @khalid19ist
    @khalid19ist 5 лет назад +2

    please how to deploy angular universal in IIS ...its bit confusing ....every only making tutorial on development mode..no one show after deployment ..please sir ....

    • @ferdinandmalcher7434
      @ferdinandmalcher7434 4 года назад

      The deployment works the exact same way as without pre-rendering. After running the pre-renderer, your "dist" folder will contain all the files, HTML and JS. You can deploy this folder as is.

  • @creativa5140
    @creativa5140 5 лет назад +1

    before of this run ng serve?

    • @ferdinandmalcher7434
      @ferdinandmalcher7434 4 года назад

      You don't need to run ng serve with Server-Side Rendering. You first need to build the client app (ng build) and the server app. The Node.js server then serves both the client and server app. Meanwhile there is also a dev server (like ng serve) for SSR. Use the generated NPM script "npm run dev:ssr" for this.

  • @klemonso
    @klemonso 4 года назад

    where is prerender.ts file !

    • @ferdinandmalcher7434
      @ferdinandmalcher7434 4 года назад

      It was in the repo. However, as for Angular 9 the pre-rendering is integrated into the Angular CLI. You just need to provide a list of routes and the CLI will take care of the rest.

  • @GlitchClaw
    @GlitchClaw 4 года назад

    👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻💖💖💖💖💖💖

  • @manikantareddyp1594
    @manikantareddyp1594 5 лет назад

    where can I get github repo ???

  • @abolfazlvayani784
    @abolfazlvayani784 4 года назад

    Hello and Thank you.. that was so great. But I'm getting "Unable to extract routes from application". and I'm using lazy loading for my routes. Also I'm using angular 9 and ivy. I added ang../univ.. but when I type "ng run [project_name]:prerender" I get this error!. I would be thankful if anyone could help me.

  • @hobbyturystaSEO
    @hobbyturystaSEO 4 года назад

    i ve been there too

  • @hos7012
    @hos7012 2 года назад

    clear but still nextjs is more easier