Skip to main content

v16

  • v16

Capturar parâmetros

1682596645841.jpg

Defer

RFC: Built-In Control Flow · angular/angular · Discussion #50719

𝐇𝐨𝐰 𝐰𝐢𝐥𝐥 𝐝𝐞𝐟𝐞𝐫𝐫𝐞𝐝 𝐥𝐨𝐚𝐝𝐢𝐧𝐠 𝐰𝐨𝐫𝐤 𝐢𝐧 𝐀𝐧𝐠𝐮𝐥𝐚𝐫❓

This deferred loading primitive makes use of the 𝐧𝐞𝐰 𝐛𝐥𝐨𝐜𝐤 𝐭𝐞𝐦𝐩𝐥𝐚𝐭𝐞 𝐬𝐲𝐧𝐭𝐚𝐱 proposed in the Control Flow RFC:(https://www.linkedin.com/feed/hashtag/?keywords=defer&highlightedUpdateUrns=urn%3Ali%3Aactivity%3A7079103534503223298). You can control when the deferrer is triggered with '𝐨𝐧' and '𝐰𝐡𝐞𝐧'.

  • 𝐨𝐧 specifies a declarative trigger condition, usually some kind of event.
  • 𝐰𝐡𝐞𝐧 specifies an imperative condition in the form of an expression that returns a boolean.

You can for example make a block load 𝐨𝐧 𝐢𝐧𝐭𝐞𝐫𝐚𝐜𝐭𝐢𝐨𝐧 or 𝐨𝐧 arrival in the 𝐯𝐢𝐞𝐰𝐩𝐨𝐫𝐭 or define a condition like any other 𝐢𝐟 𝐜𝐨𝐧𝐝𝐢𝐭𝐢𝐨𝐧 and 𝐥𝐨𝐚𝐝 𝐰𝐡𝐞𝐧 𝐭𝐡𝐚𝐭 𝐫𝐞𝐬𝐨𝐥𝐯𝐞𝐬 𝐭𝐫𝐮𝐞.

What do you think of deferred loading? Personally it think it rocks and is a great addition to the Angular framework! I really can't wait for this to be added, if you want to read more about deferred loading you can go to the official RFC discussion:

Untitled

alt text

Conversão

1690805182469.jpg