Angular Server Side Rendering | Angular SSR | Angular Universal

Поділитися
Вставка
  • Опубліковано 31 січ 2025

КОМЕНТАРІ • 58

  • @MonsterlessonsAcademy
    @MonsterlessonsAcademy  5 місяців тому

    WATCH NEXT: Angular Unit Testing Course - All That You Need to Know About Testing - ua-cam.com/video/bv9z_UfSqgM/v-deo.htmlsi=WVzOWtdQUZWEbqsz

  • @stephenzerfas5307
    @stephenzerfas5307 Рік тому

    Great tutorial and you make good points. I am glad you take time to explain why SSR is not a solution for everything. I feel like SEO as you mention is one of the best reasons to use it.

  • @amanuelgetachew8207
    @amanuelgetachew8207 Рік тому

    With angular 15, installing it was a pain(dependency issues here and there) so I reverted the project back to 14 and everything went fine.
    Thanks for the video, nice and pragmatic

  • @brightokoro7073
    @brightokoro7073 5 місяців тому

    Nice insight thanks for sharing

  • @CodingAbroad
    @CodingAbroad 2 роки тому +6

    I’m using Angular Universal for my new jobs website. All good so far. The transfer state that you mention in this video now has its own module which automatically gets installed as of Angular 15 (so you no longer have to do all those if statements anymore). Only annoyance is the module only works for GET methods which is fine for most circumstances. However I have a search feature which uses POST and the state transfer module doesn’t work on POST calls. I’ve seen it’s just an interceptor but when I tried to make my own one nothing seemed to work. If you happen to find a solution I would be forever grateful (loads of people are having the same problem)

    • @MonsterlessonsAcademy
      @MonsterlessonsAcademy  2 роки тому +1

      But realistically post request for search is not something that you want to execute on server. To render a page as fast as possible you need to reduce the amount of requests and search doesn't sound like something I would fetch on server side.

    • @CodingAbroad
      @CodingAbroad 2 роки тому

      @@MonsterlessonsAcademy hmm well I can see why the back end team decided to make it a POST. It’s a really extensive search payload that is sent in the body. Some arrays, objects, strings and numbers. It would get very messy if sent in the query params of a GET request

    • @CodingAbroad
      @CodingAbroad 2 роки тому

      @@MonsterlessonsAcademy the user is searching university programs so there’s so many parameters to search on. Subjects, start dates, degree type etc

    • @MonsterlessonsAcademy
      @MonsterlessonsAcademy  2 роки тому

      @@CodingAbroad But you can still subscribe to post request and set transfer state or?

    • @CodingAbroad
      @CodingAbroad Рік тому

      @@MonsterlessonsAcademy hmm I tried doing it following your example but in my particular circumstance I’m using the async pipe. I tried converting it to subscribe but it wasn’t working either. I think I really need to use an interceptor to make life easier but it’s a bit above my head

  • @brucearmstrong5536
    @brucearmstrong5536 2 роки тому +11

    1.) There is an angular meta framework called Analog , it can do SSR and SSG on angular
    If u go through , please do a video on that
    2.) There is new version on NGRX and it supports standalone components and new way for implementing store
    Please do video on that if possible
    3.) There is something called reactivity that's coming to angular where angular uses signals are something, which might eliminate zone js , im not sure about this

  • @tanyamironchik2964
    @tanyamironchik2964 Рік тому +2

    Thanks a lot for your video! I have one question: I'm learning Angular now and SSR with him - If we run "npm run dev:ssr" we use SSR? and why do we have isPlatformBrowser is true for localstorage? How can I understand about SSR? Maybe do you know a good articles for me? I would be thankful for that!

  • @suatogos
    @suatogos Рік тому

    What a beautiful tutorial is this! thanks a lot ❤

  • @ashotvoskanian9400
    @ashotvoskanian9400 10 місяців тому

    Hi, thanks for the interesting content. I have two questions:
    1) I insert meta tags dynamically, but still it is not reflected in the source code
    2) How to deploy during SSR, should we upload any file along with the dist to the server.
    Thank you very much

    • @MonsterlessonsAcademy
      @MonsterlessonsAcademy  10 місяців тому

      1. I didn't do that so can't comment
      2. You need a running backend server which serves constantly your angular app.

  • @Anonymous-kk3rg
    @Anonymous-kk3rg Рік тому

    I have a very big production level project . How can i use angular universal in that ? I can't have multiple if statements and so on . Any workarounds ?

  • @hamza201183
    @hamza201183 Рік тому

    Hi Oleksandr, why does isPlatformBrowser() return 'true' in your example?
    Normally it should return false because we use SSR. I'm lost :)

    • @MonsterlessonsAcademy
      @MonsterlessonsAcademy  Рік тому

      isPlatformBrowser() doesn't means that we are in SSR project. It means that our current platform is browser and not server side. it will be false inside node and true in client javascript.

    • @hamza201183
      @hamza201183 Рік тому

      @@MonsterlessonsAcademy But now you use node, and not the browser. So why does it return true? Sorry I still don't get it :)

    • @MonsterlessonsAcademy
      @MonsterlessonsAcademy  Рік тому +1

      @@hamza201183 You use both. The app is rendered once in backend and once in client. And in code we must know where we execute it

    • @hamza201183
      @hamza201183 Рік тому

      @@MonsterlessonsAcademy Oh ok wow...I really need to learn more about Angular Universal. Thank you very much :)

  • @lavpandey3028
    @lavpandey3028 Рік тому

    Sir, how to use this with nx monorepo having an angular project. Nx version and angular version is 16.
    I tried adding Angular Universal command but it says cannot be added outside of workspace, pls guide me.

  • @obaku1980
    @obaku1980 Рік тому

    i wonder how it would work with dynamic data such a websocket or virtual grids for pagination, still it looks amazing.

    • @MonsterlessonsAcademy
      @MonsterlessonsAcademy  Рік тому +1

      It doesn't. You have an initial render on server and then on client it will enable sockets to update the app.

  • @shadialhaj679
    @shadialhaj679 Рік тому

    Thanks for very nice toutrial,
    We are facing one issue with router-outlet for dynamic routing the content not shown inside page source and we get this
    Could you please advise,
    Thanks,
    Shadi

  • @triloksingh8596
    @triloksingh8596 Рік тому

    After integrate ssr , if want use only csr . Will ssr side effects in csr mode ? Because sometimes i dont want to use ssr .

  • @yuriinadilnyi3029
    @yuriinadilnyi3029 Рік тому

    I believe the better way to define if we can access to local storage dynamically with factory function in a root module it's more centralized approach
    p.s: if it's possible of course

  • @jesuisuneia
    @jesuisuneia Рік тому

    Hi, I want a static html page as a landing page, which is ok for SEO, and the rest of the application as js. What is the best way to implement this ?

  • @KannanR-x7r
    @KannanR-x7r 11 місяців тому

    i after installed angular universal package successfully when i run npm run dev:ssr showing this error Configuration 'development' is not set in the workspace. can you please explain this scenarion what can i do

  • @cilcoposea
    @cilcoposea Рік тому

    I was wondering: Does Angular universal SSG work with Standalone Apis ? Since i migrated to Angular 16, I thought everything was fine, until i migrated to Standalone Apis, then SSR worked like a charm with clientHydration, but SSG (prerender) does not work anymore. I just end up with a not working (no errors).

  • @armandmugabo1170
    @armandmugabo1170 Рік тому

    Thanks a lot

  • @paulh6933
    @paulh6933 2 роки тому

    when u save users into state, it is users at a point in time correct? so if another user was added it won't show up client side, correct?

  • @SameeraMadhushan-jc7ip
    @SameeraMadhushan-jc7ip Рік тому

    I tried to install SSR to my project , Its angular version is 15.1.4, but SSR not installing to my project its show this issue Path "tsconfig.server.json" does not exist.

    • @MonsterlessonsAcademy
      @MonsterlessonsAcademy  Рік тому

      I never had such problem so I can't help here.

    • @simoghf1888
      @simoghf1888 Рік тому

      trynna delete the new scripts added to angular.json. Because once you tried to install it before, it won't retry to reupdate the code, it'll try to execute stuff and then it dosen't find all the imports and files. So the idea is to revert all changes before you installed it (Delete new file, delete angular JSON scripts ...) and reinstall the latest version (it works)

    • @SameeraMadhushan-jc7ip
      @SameeraMadhushan-jc7ip Рік тому

      @@simoghf1888 thank you I will try

    • @simoghf1888
      @simoghf1888 Рік тому

      @@SameeraMadhushan-jc7ip No need ✌

  • @utsho.sardar
    @utsho.sardar 2 роки тому

    i thought angular developed a ssr framework a year ago. Is it already out or in process? anyone knows ?

    • @MonsterlessonsAcademy
      @MonsterlessonsAcademy  2 роки тому

      I never heard about ssr frameworks in Angular. If you know please let me know.

    • @maximezanos
      @maximezanos 2 роки тому

      AnalogJS maybe ?
      But that's not from the angular team.

  • @HarshallDaware
    @HarshallDaware Рік тому

    Not able to it. When i am running the command - ng add @nguniversal/express-engine
    It says Packages installation failed giving warning as
    1. Unable to find compatible package. Using 'latest' tag.
    2. Package has unmet peer dependencies. Adding the package may not succeed.

    • @MonsterlessonsAcademy
      @MonsterlessonsAcademy  Рік тому

      No idea. So local problem that you need to debug. Might be Angular/Node version.