Getting Started with Standalone Components in Angular

Поділитися
Вставка
  • Опубліковано 24 гру 2024

КОМЕНТАРІ • 146

  • @kedevked
    @kedevked 2 роки тому +63

    Angular keeps on becoming better and better 🎉🙏🏾

  • @bestraub98
    @bestraub98 2 роки тому +26

    Finally! This was the main feature angular was missing, compared to react and vue. It makes refactoring so much easier (just because less files are involved).

  • @lukash9952
    @lukash9952 2 роки тому +10

    Love this new feature! Used it already in prod project.

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

    Amazing feature, when building with react component , we expected something we need here in Angular also..
    Thanks you Angular team..

  • @elavarasur3458
    @elavarasur3458 Рік тому +10

    NgModules essentially were a skeleton structure which gave angular apps its architecture and making them optional will allow developers to create apps in an unopinionated manner like react.
    Angular's inbuilt architecture is the one of the best features and an important reason to be adopted by enterprises and they just undid this. This looks like a step backward than forward.
    Can someone please tell me how this feature and this direction is a good thing....?

    • @ki9wi
      @ki9wi Рік тому +4

      can be used for small apps and made learning angular easier for absolute starters not having the modules concept as a must.

    • @shivenigma
      @shivenigma 3 місяці тому

      I agree with you on this. The standalone thing never made any sense to me, just like we are trying to be like react?

  • @josephsackeykontor4138
    @josephsackeykontor4138 2 роки тому +3

    I love this feature. Finally, it is here

  • @nahuelleiva8460
    @nahuelleiva8460 2 роки тому +14

    This is an amazing feature because it reduces the number of files you'll need to handle in your project but I think it will be widely used to implement small components rather than bigger ones.
    For bigger/larger/more complex components, having separate things will be a cleaner and wiser approach. I don't see a component with a certain level of high complexity being developed using standalone components, having that much HTML code inside a single file could be a bit messy to deal with. But it's my guess, I could be wrong.

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

      Yessss! Imho It will nudge you to split your components earlier down to reusable pieces, instead of the ever-growing monstrous components that mingle too much together! :D

  • @yuriimarshalofficial
    @yuriimarshalofficial Рік тому +3

    Thanks for explaining, I rewrote the project today, removed all modules and set components as standalone. Now I feel like the most standalone programmer with all that provider functions at main.ts file. The framework is moving to splitted direct dependencies more and more. That's the great decision but also I so used to work with modules) For now my feature folder is determined with routing of lazy loading components. Please create more examples of all native modules providers that were wrapped by functions with new naming 🙏❤

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

    Great api, the ngmodule was time consuming for quick startup.
    But lazy loaded was existing in previous version

  • @scottwong365
    @scottwong365 2 роки тому +8

    How does setting up specs work? Normally we define a testing module with all the imports/declarations.

  • @munaq-jp
    @munaq-jp 2 роки тому +35

    With the popularization of Single Component Angular Modules (SCAM), standalone components was the most obvious next step. I'm thrilled this happened so seamlessly.
    ps. Am I the only one weirded out by how clear the mic sound is? now I want to know what microphone was used.

    • @markthompson-g
      @markthompson-g 2 роки тому +17

      I can tell you exactly which :) We used the Rode NTG3 for this video. Also, I'm so glad you are enjoying Standalone Components!

    • @munaq-jp
      @munaq-jp 2 роки тому

      @@markthompson-g Hey! Thanks for the tip on the mic! And I'm loving standalone components. Perfect for dynamic instantiation too!

  • @MelroyvandenBerg
    @MelroyvandenBerg 9 місяців тому

    Thanks for the link to the example code!

  • @MelroyvandenBerg
    @MelroyvandenBerg 9 місяців тому +1

    When I use: `ng generate component DogsList --flat --standalone`. I no longer get the CommonModule as imports nor implements OnInit by default in my generated code. is that correct??

  • @feelwang
    @feelwang 2 роки тому +4

    I guess that means Shared “components” module now can be rightly replaced by a folder of standalone components?

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

    This is a great feature. Looking forward to when this is production ready

  • @Whizyrel
    @Whizyrel 2 роки тому +5

    I see, "I am standing here alone...". Nice entry point 😂

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

    This change turned out to be a lot better than I expected. Glad to see the bloat-ware that Angular is being improved.

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

    Excited to work with this feature.

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

    Is it possible to avoid doing boilerplate import of CommonModule ?

  • @tusharbhattacharya6215
    @tusharbhattacharya6215 2 роки тому +4

    What was the vscode theme?

  • @robertotomas
    @robertotomas 2 роки тому +2

    How do standalone components play with federation?

  • @f1amesoff
    @f1amesoff Рік тому +13

    I've switched to Enterprise project based on React about a year ago, so I have the competence to compare two ecosystems. Damn, Angular is like a swizz knife has everything you need, has way better documentation and better standards, I kinda miss it. The only flaw is performance in some cases, but I think the Angular team will resolve this issue eventually by switching the compiler to esbuild and by making zone.js and rxjs optional.
    It can be faster and lighter without losing its versatility.

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

      It is now, and signal-based components will be a total game changer. Signals as component inputs ftw! Cheers

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

      The documentation was exactly what made me choose Angular over React for my project

  • @RobbieSherman
    @RobbieSherman 2 роки тому +3

    Why did you add "!" after dog and index in Input'ing them?

    • @williamboshi1855
      @williamboshi1855 2 роки тому +9

      Iirc ? Is "type or null or undefined" while ! Is "I know I'm not initialising my var but trust me bro it won't be null" cause Angular will inject the value and typescript doesn't know that

    • @dimitritsikaridze6220
      @dimitritsikaridze6220 2 роки тому +4

      it's because of tsconfig option strictTemplateChecking is set to true
      edit: correction - it's just property "strict" that is set to true in tsconfig which applies all kinds of strict settings, if you want to get rid of "!" you need to set new property strictTemplateChecking to false

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

    Great feature and presenattion. Thank you

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

    What about service dependencies? For example, a service that depends on the HttpClientModule. Who imports that? I don't like the idea of the consuming component having to know about dependencies of dependencies.

  • @babchenkonikolay911
    @babchenkonikolay911 2 роки тому +7

    This is so clean!

  • @randomlee101
    @randomlee101 2 роки тому +2

    How do I upgrade my current project to Angular 14? I want to be able to add title to my routes 🙂

  • @ste-fa-no
    @ste-fa-no 5 місяців тому

    Great video, and I loved the puns 🖖

  • @md.zahidhasansohan6921
    @md.zahidhasansohan6921 2 роки тому +2

    great thanks for that! Very clear and articulate!

  • @TayambaMwanza
    @TayambaMwanza 2 роки тому +3

    That pun took me 2 seconds but it definitely hit 🤣

  • @poloptree2
    @poloptree2 18 днів тому

    One thing i dont understand about standalone components is the sheer amount of imports you need for even simple components. A material modal takes an absolute ton of modules to work properly and becomes cumbersome to manage. Am i doing something wrong?

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

    Super cool! What is the VS Code skin you’re using?

    • @JeromeGuarin
      @JeromeGuarin 2 роки тому +3

      I think that's VS Code's high contrast theme

    • @markthompson-g
      @markthompson-g 2 роки тому +1

      @@JeromeGuarin that is correct!

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

    Hi. I hava a doubt. If You create a service to Open diálogs. How do You import the diálogModule in said singleton?

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

    Great guys, standalone components are stable now?

  • @LimitlessMinds
    @LimitlessMinds 2 роки тому +4

    There are no links to the example project as said at the end of the video 😅

  • @seabird021186
    @seabird021186 2 роки тому +10

    Sample of Demo is not good, If you use : Learn More This page will reload all scripts, images, including [main.js] . So, I recommend you demo with using [routerLink] to reload only script.

    • @GeoffTripoli
      @GeoffTripoli Рік тому +4

      Ya, she actually says they are using the "routerLink" directive, but then they type an "href". Oops.

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

    Is it normal to not have the routerModule in the imports array of DogViewComponent (which is using ActivatedRoute from @angular/router) ?
    Do we need to add the module into the imports array only when we are using this module into the component template ?

  • @zoro9878
    @zoro9878 2 роки тому +2

    angular is going to take over the front-end world!!

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

    In angular 2 also ng module concept was not there

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

    Love the way Angular is slowly making itself a clone of React 😆

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

    Will this new feature reduce the total blocking time in google web page speed? If yes this is HUGE!

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

    Will standalone components work with scully?

  • @nathanalberg
    @nathanalberg 2 роки тому +2

    I think its important to highlight that the lazy load method is `loadComponent`.... not `loadChildren` ... which is how other parts of my app are lazy loading modules... I didnt realize this and was getting `Error: ASSERTION ERROR: NgModule 'LoginPageComponent' is not a subtype of 'NgModuleType'. [Expected=> null != null

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

    Very cool, I'm using standalone components only since it got out, my app got no modules whatsoever

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

      How did it affect your bundle size?

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

      As Fit suit asked, I'm also interested to know the bundle size. How did it compare to the old version?

    • @Tomas-ir8xl
      @Tomas-ir8xl 2 роки тому

      @@fitsuit1555 It reduces the bundle size. In my case "initial chunk" file size decreased by around 3% after getting rid of all NgModules.

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

    thanks, very clear presentation

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

    Can these be npm packaged?

  • @GoodcitizenCA
    @GoodcitizenCA 4 місяці тому

    Thanks for the tutorial and English English

  • @dr.d3600
    @dr.d3600 2 роки тому

    Cool for standalone components
    But are you error using href in a link?

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

    THANK YOU! for such a great job!

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

    Beautiful!! This new feature sounds promising and it feels Angular is getting lighter and lighter. Thanks

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

    much easier now! thanks.

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

    thanks for the video, it was really informative

  • @turyng-or1js
    @turyng-or1js Рік тому

    "This is of a great IMPORTance"😍

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

    What is the meaning of "!" in "@Input() dog!: Dog;"?

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

      That's called the "Non-null assertion operator" and it asserts that the value of the input passed into the component won't be null.
      Here's more information: www.typescriptlang.org/docs/handbook/release-notes/typescript-2-0.html#non-null-assertion-operator

  • @tharindu79
    @tharindu79 6 місяців тому

    Loved those puns 😊

  • @surajbande5841
    @surajbande5841 2 роки тому +3

    exciting feature! Thank you team for your efforts.. appreciate lot! Looks like Angular is becoming pure components based like other frameworks.. looking forward to using it soon in the project..!!

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

    Will this increase the build size with all the imports? and is there any use for modules at all after this? Shared import maybe?

    • @catalintudorciurte309
      @catalintudorciurte309 2 роки тому +2

      This feature is especially usefull to replace the shared module pattern, where you just threw everything in there and imported it everywhere.
      The downside of standalone components, compared to ng-modules is that they provide no dependency encapsulation.
      So, the rule of thumb will be: "Will I need to hide dependencies and expose only SOME components?" Then you go for an ng-module, otherwise for standalone components

    • @Tomas-ir8xl
      @Tomas-ir8xl 2 роки тому +2

      No, it actually decreases production bundle size (especially if you import only specific directives and pipes instead of importing whole "CommonModule" and "RouterModule" everywhere). Just migrated a small project and the "initial chunk" file size decreased by around 3% after migration.

  • @Андрюхаслазерки
    @Андрюхаслазерки 2 роки тому +2

    Good video. Thank you.

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

    What vscode theme is she using? :OO

  • @collinsk8754
    @collinsk8754 2 роки тому +3

    Interesting addition 🤔. But, I think I'll stick to the existing modus operandi for components😎.

  • @Meolafon
    @Meolafon 2 роки тому +3

    Very interesting, but I am a bit concerned about editing templates as a string (no IDE support) inside of a component file

    • @munaq-jp
      @munaq-jp 2 роки тому +5

      VS Code supports syntax highlight and intellisense for inline templates. But you can still use a separate HTML file for the template as usual.

    • @Tomas-ir8xl
      @Tomas-ir8xl 2 роки тому +2

      You don't have to use inline templates with "standalone" components. The feature helps you get rid of NgModules, it has nothing to do with inline html template.

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

    Finally, coping up with react and other web frameworks.

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

    saludos seria muy bueno si estuviera también en español para la comunidad que no hablamos ingles fluido... gracias

  • @AdrianClaudiuDima
    @AdrianClaudiuDima 2 роки тому +4

    Keep up the good work ! 👌👌🎉🎉 Although it is a very nice feature, I’m afraid it will not be used as per design, especially for the new devs staring with Angular.

  • @pepew7102
    @pepew7102 2 роки тому +2

    Do you have any plan of removing RxJS completly from Angular ?

    • @LarsRyeJeppesen
      @LarsRyeJeppesen 2 роки тому +4

      Hopefully not. Promises suck

    • @pepew7102
      @pepew7102 2 роки тому +3

      @@LarsRyeJeppesen The reason why Angular is struggling to survive is mainly RxJS (and modules). It's adding unecessary complexity. React, Vue, Svelte, Solid, etc are working perfectly fine without RxJS.

    • @LarsRyeJeppesen
      @LarsRyeJeppesen 2 роки тому +3

      @@pepew7102 I dont think A gular should be dummed down by looking at older frameworks like you mentioned. Observables are vastly superior to promises.

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

      @@LarsRyeJeppesen I agree that observables are more powerful than promises but also a lot more complicated to understand. And most of the time the power of observables is just not necessary (for example http requests).

    • @catalintudorciurte309
      @catalintudorciurte309 2 роки тому +4

      Angular is coupled forever with rxjs. It will never go away. Nor should it go away. Rxjs is one of the most rewarding libraries there are

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

    Its a great improvement towards moving to functional based programming from class based ones. I wish this will become the default in angular future. Makes beginners user friendly developers experience. Congratulations Angular !!!!😁🥳

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

      I doubt they will change from class components to function components. And they really shouldn't.

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

    this is how out minds think, in components rather than modules

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

    great, thanks!!

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

    So Angular is becoming more like React and Vue?

    • @TayambaMwanza
      @TayambaMwanza 2 роки тому +2

      This is something the Angular team has been aiming for a while, ngModules was always a temporary solution, I don't think you can say that standalone components is really special to any particular framework it's just that Angular didn't have it.

  • @shivrajdeopa1571
    @shivrajdeopa1571 2 роки тому +2

    🙏 great presentation

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

    Amazing!

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

    Many thanks

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

    "Standing Alone" to tell us about StandAlone Components...good one 😂😂

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

    Greeeeeat

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

    it would be cool if the standalone component can define its own route. Then there would not be a need to define it in app routes or module routes.

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

      What's your thought process for how this would work?

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

      This is a really bad idea. Like incredibly bad. Please don't do this lol

  • @theanswer1993
    @theanswer1993 2 роки тому +2

    What is the advantage if you are already fine with the module approach? As far as I see it's just a simplified version of Angular for those coming from React and Vue aka less skilled developers who want to get into Angular but can't figure out Modules. So I see this more of a survival move from Google as Angular started to become less and less popular as noobs don't want to start with it.

  • @WesFanMan
    @WesFanMan 2 роки тому +2

    ...simplified the Angular learning tree... yeah, good luck with that.

  • @chaka1530
    @chaka1530 2 роки тому +2

    Are there people who are fan of modules, or I am the only one? I like when the enterprise projects are structured in a neat way using NgModules. Switching to standalone components seems unnecessary and potentially messy as the app grows.

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

      you're not alone here. you'll have to group them anyway at the end

  • @ben-barbier
    @ben-barbier 2 роки тому

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

    Great !)

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

    Dope

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

    I saw you were using the "redirect" as the first route,I learned at Docs that should precede the wildcard.
    anyways, the explanation was extremely good

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

      She just wanted to redirect from `/` to `/list` not any page.

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

    🎉

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

    As an experienced react dev I'm happy when i see angular becoming better, glad the team is working extra hard to improve angular and make it on par with react

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

    "Import...tance." and "view... of that."
    The face after the jokes killed me. x)
    Angular is more awesome...er.
    Btw, What a weird vscode theme. o.o

  • @andreip.8321
    @andreip.8321 10 місяців тому

    so painful seeing the navigation to dogView using a href...

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

    Good info but not professional. Because it doesn't talk about concrete roadmap. What is the place of module and component in the future. Doesn't give confidence about how to design for future compliance.

  • @aurelanghel5029
    @aurelanghel5029 3 місяці тому

    wow and ... wow

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

    Sick

  • @dublindynamicdrive
    @dublindynamicdrive Місяць тому

    so many puns hahaha!

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

    Watering down to react level

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

      Neh, it is good to have options. ng-modules will not dissapear, standalone components will just replace the SCAM pattern

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

      How is it watering down to have components manage dependencies directly? I actually found it's easier to organize your codebase than shared module.

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

    Using href here makes the whole app reload... are you serious Angular ?

  • @back-ups7919
    @back-ups7919 9 місяців тому

    She speaks Tahoma

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

    Uhmmmm... Angular getting away from being Angular...?

  • @gc-226hugo4
    @gc-226hugo4 4 місяці тому

    NONONONO ESTA MAL ESO NO. ASI NO ES!!!

  • @balaloha
    @balaloha 7 місяців тому

    is this AI?

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

    Hi Angular Team,
    My request is to remove package.json and node modules in your next versions...
    As it affects in my projects as devloper we need to setup locally angular project..But it become complex ..more errors are comming
    My opinion,we can use angular without package.json..Just like Deno works..We move forward we can inhance performance and any body can upgrade the angular project..
    Please look into these case .
    Thanks
    Aayush Gupta