Angular's New @for Block Features

Поділитися
Вставка
  • Опубліковано 1 лип 2024
  • The @for block, part of Angular's new control flow syntax, is great for repeating HTML elements in our templates. And it provides useful features such as an @empty block, odd and even row indication, and easier change tracking.
    In this video, we walk through five fun features of the @for block.
    Links
    Code: stackblitz.com/~/edit/fun-for...
    UA-cam video: "Angular's New Template Syntax: Control Flow": • Angular's New Template...
    UA-cam video: "Automatically Migrate to Angular's New Control Flow Template Syntax": • Automatically Migrate ...
    Content
    00:00 @for block
    00:46 @empty block
    01:25 $index
    02:14 $first, $last, $odd, $even
    04:03 $count
    04:57 track
    00:00 Wrap up
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    😊About Me
    Hey! I'm Deborah Kurata
    I'm a software developer and UA-cam content creator. I speak at conferences such as VSLive and ng-conf. I write articles for freeCodeCamp. And I'm a Pluralsight author with courses in the top 10 most popular (out of 7,000+) for over 5 years. For my work in support of software developers, I've been recognized with the Microsoft Most Valuable Professional (MVP) award, and I'm a Google Developer Expert (GDE).
    View my UA-cam content: / @deborah_kurata
    Contact me on Twitter: / deborahkurata
    Find my Pluralsight courses: www.pluralsight.com/profile/a...
    Access my freeCodeCamp articles: www.freecodecamp.org/news/aut...
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    #angular
    #angulartutorials
    #angulartutorial
    #angulardevelopers
    #angularbestpractices
    #angular17newfeatures
    #angular17newfeature
    #angular17features
    #@for
    #@forinangular
    #@forinangular17
    #angularnewfeatures
    #featuresinangular17
    #angular@forloop
    #angular@for
    #angularlatestfeatures
    #whatis@forinangular
    #angularfeaturesandupdates
    #angular17featuresandupdates
    #angular@forcontrolflow
    #angular@forsyntax
    #angular17featureswithexample
    #@forinangular17withexample
    #angularbestpractices
  • Наука та технологія

КОМЕНТАРІ • 34

  • @EmilioDegiovanni
    @EmilioDegiovanni 7 днів тому +1

    @empty and @for track without declaring a new component method are great features

  • @ali-13392
    @ali-13392 7 днів тому +1

    Fantastic, thank you so much Deborah!!

  • @haroldpepete
    @haroldpepete 8 днів тому +1

    great video, i saw your ng-conf video but they have disabled the comment section, so i take this section to greet you and thank you for such an excellent video

  • @mounirboussetta
    @mounirboussetta 8 днів тому

    As always, you come up with great stuff from the basics. Thanks.

  • @ChrisTapay
    @ChrisTapay 7 днів тому

    Concise and helpful. Thanks Deborah!

  • @richarddefortune1329
    @richarddefortune1329 8 днів тому

    Great as usually

  • @rolygonz1964
    @rolygonz1964 7 днів тому

    ❤❤❤❤❤❤❤❤ thank you

  • @mohamedbechere4159
    @mohamedbechere4159 7 днів тому

    Great content. Many thanks

  • @IgMa-tc1oj
    @IgMa-tc1oj 8 днів тому +1

    Your lessons are excellent as always. Very beautiful hairstyle for the intro, you are a beauty. Thank you for being you, Deborah!

  • @marcosjrs
    @marcosjrs 7 днів тому

    thanks!

  • @Brendan2Alexander
    @Brendan2Alexander 7 днів тому

    nice. wasnt aware of odd, even, count.

  • @paulodetarsofm
    @paulodetarsofm 6 днів тому +1

    What if instead of creating the variables inside @for we use the $ variables ($first, $last, etc.) directly in the template? Are there any disadvantages?

    • @deborah_kurata
      @deborah_kurata  5 днів тому +4

      Yes! The aliasing is optional. I've always done that out of habit, but the let is not required. You can use the variables directly in the template.

  • @iuliusciorica282
    @iuliusciorica282 8 днів тому

    ❤️

  • @Edgars82
    @Edgars82 7 днів тому

    if using track function should not we call it with this new @syntax? track trackSnak(snack)?

    • @deborah_kurata
      @deborah_kurata  6 днів тому

      You can just pass the function name. That's easier/shorter.
      But if you did want to call it manually, you'd have to pass both arguments: trackSnack($index, snackItem)

  • @rishukumar7586
    @rishukumar7586 8 днів тому

    for some reason your stackblitz url is not working

    • @deborah_kurata
      @deborah_kurata  8 днів тому +1

      Sorry about that. I just fixed it. Can you try again?

    • @rishukumar7586
      @rishukumar7586 7 днів тому

      @@deborah_kurata thanks for sharing it is working now 👍

  • @khyr-hl9yt
    @khyr-hl9yt 7 днів тому

    I am curious to know why people don't prefer to keep their business logic inside service file, instead they prefer to use a service as a rest API layer only ?

    • @deborah_kurata
      @deborah_kurata  6 днів тому

      It is recommended that business logic go in a service. This sample application was focused on the @for block, so I didn't take the time to move all of the signals from the component to the service, if that's what you are referring to.
      And definitely things like displaying the row number and odd/even highlighting would be UI and not really business logic, right?