<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: khizerrehandev</title>
    <description>The latest articles on DEV Community by khizerrehandev (@khizerrehandev).</description>
    <link>https://dev.to/khizerrehandev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F77542%2F7fe010a5-5bca-4702-a194-3bce7b6103d8.jpeg</url>
      <title>DEV Community: khizerrehandev</title>
      <link>https://dev.to/khizerrehandev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/khizerrehandev"/>
    <language>en</language>
    <item>
      <title>Object.GroupBy functionality</title>
      <dc:creator>khizerrehandev</dc:creator>
      <pubDate>Tue, 19 Sep 2023 06:45:52 +0000</pubDate>
      <link>https://dev.to/khizerrehandev/objectgroupby-functionality-4od6</link>
      <guid>https://dev.to/khizerrehandev/objectgroupby-functionality-4od6</guid>
      <description>&lt;h2&gt;
  
  
  Still Experimental Feature
&lt;/h2&gt;

&lt;p&gt;Following &lt;a href="https://caniuse.com/?search=Object.groupBy"&gt;Browsers&lt;/a&gt; has supported this feature  in Chrome, Edge, Safari 117 version.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qQrHfsuw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x2xj0vbqos22ww17h8gi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qQrHfsuw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x2xj0vbqos22ww17h8gi.png" alt="Image description" width="800" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before it was Introduced in browser following implementations were done using:&lt;/p&gt;

&lt;h4&gt;
  
  
  Using Array.reduce method
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;groupBy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;people&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Alice&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Bob&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Charlie&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;David&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;// Using Reduce Method&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;groupByAge&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;groupBy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;people&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Using Object.prototype method
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;groupBy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;people&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Benefits:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Implementation is more Abstracted and provided by browser API's&lt;/li&gt;
&lt;li&gt;Noise reduction from developers POV and reducing adding custom support for this method&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Important Notes:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;The return value of groupBy is an object that does not inherit from %Object.prototype%.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;groupBy calls &lt;code&gt;callbackfn&lt;/code&gt; once for each element in items with &lt;code&gt;callbackFn(groupItem, index)&lt;/code&gt; just like normal callback functions e.g &lt;code&gt;map&lt;/code&gt;, &lt;code&gt;filter&lt;/code&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make sure browser supports this method and it is not recommended for production env as it still needs to be supported by major KEY players by web browsers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It is still not supported in Firefox, Opera, IE refer always &lt;a href="https://caniuse.com/?search=Object.groupBy"&gt;caniuse&lt;/a&gt;to see supported versions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let me know your thoughts via comments and feedback. 💬&lt;/p&gt;

&lt;p&gt;Happy coding and Happy Learning! 🎉 &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>groupby</category>
      <category>mdn</category>
    </item>
    <item>
      <title>[RFC: #50719]: Angular new Built In Control Flow Syntax 🚧 📢</title>
      <dc:creator>khizerrehandev</dc:creator>
      <pubDate>Sun, 23 Jul 2023 12:45:54 +0000</pubDate>
      <link>https://dev.to/khizerrehandev/rfc-50719-angular-new-built-in-control-flow-syntax-c4</link>
      <guid>https://dev.to/khizerrehandev/rfc-50719-angular-new-built-in-control-flow-syntax-c4</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fJdGBOoY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vdvq65wzygzncfvsv2si.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fJdGBOoY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vdvq65wzygzncfvsv2si.jpg" alt="Syntactic Sugar" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Angular teams has been working hard to introduce some cool features in upcoming releases and before going getting things into production. Team has opened a new RFC to provide &lt;code&gt;new&lt;/code&gt; control flow syntax to support &lt;code&gt;zone/zoneless&lt;/code&gt; based applications.&lt;/p&gt;

&lt;p&gt;Newly proposed syntax is just &lt;strong&gt;SYNTACTIC SUGAR* it will provide common &lt;code&gt;Interface&lt;/code&gt; to &lt;code&gt;*&lt;/code&gt; structural directives in order to avoid awkwardness syntax underlying for **each&lt;/strong&gt; &lt;br&gt;
structural directive.&lt;/p&gt;

&lt;p&gt;As per RFC&lt;br&gt;
&lt;em&gt;"...technically &lt;code&gt;internals&lt;/code&gt; of the new control flow will use the &lt;code&gt;same&lt;/code&gt; concepts as the structural directives, including s and view containers.&lt;/em&gt;"&lt;/p&gt;

&lt;h4&gt;
  
  
  Why do we need &lt;code&gt;NEW&lt;/code&gt; control flow syntax?
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In current implementation *ngIf, *ngFor, [ngSwitch] which are just sugar coated over &lt;code&gt;ng-template&lt;/code&gt; therefore adding complex conditional logic will add/require multiple &lt;code&gt;ng-template&lt;/code&gt; under the hood based on nesting level.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Current syntax not handle &lt;code&gt;if/else if/else&lt;/code&gt; in convenient way which adds a-lot of boilerplate code wrappers under the hood by framework which adds more &lt;strong&gt;complexity&lt;/strong&gt; while reading code and maintaining templates.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No strict template checking is done for &lt;code&gt;ngSwitch&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can't add &lt;strong&gt;multiple directive&lt;/strong&gt; within same element instead either you have to use either &lt;code&gt;special&lt;/code&gt; element called &lt;code&gt;ng-container&lt;/code&gt; or use normal &lt;code&gt;HTML&lt;/code&gt; element.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To stay relevant with Javascript or Other framework syntax to have less steep curve.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Lastly &lt;strong&gt;existing&lt;/strong&gt; directives not able to function for zoneless application e.g signals implementation therefore angular team has proposed a new &lt;strong&gt;built-in control&lt;/strong&gt; flow syntax for templates in order to support zone (&lt;strong&gt;&amp;lt;v16&lt;/strong&gt;) / zoneless (&lt;strong&gt;v16+&lt;/strong&gt;) applications&lt;/p&gt;

&lt;h2&gt;
  
  
  New proposed control flow syntax
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Conditional Control flow&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keywords

&lt;ul&gt;
&lt;li&gt;if/else if/else&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Old Syntax&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bH2ALWWX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/675wwqp1hu6ktsh94qvy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bH2ALWWX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/675wwqp1hu6ktsh94qvy.png" alt="If/Else old syntax" width="800" height="546"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;New Syntax&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--n3G2sNCW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4izqqrmfu7vaundvcit5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--n3G2sNCW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4izqqrmfu7vaundvcit5.png" alt="If/else new syntax" width="800" height="290"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Switch Control flow&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keywords

&lt;ul&gt;
&lt;li&gt;switch/case/default&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;OLD Syntax&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--x9UwyESb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oawyv25348s7bggan0if.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x9UwyESb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oawyv25348s7bggan0if.png" alt="switch old syntax" width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;New Syntax&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DDoPfnX6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cjiomgbonysthylp50t3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DDoPfnX6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cjiomgbonysthylp50t3.png" alt="switch new syntax" width="800" height="709"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: No &lt;code&gt;break&lt;/code&gt; statement required 🎉&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;👉 Interesting way to support multiple cases within a switch.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RGsl5hdM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x6swus2h1h89hse1lzfy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RGsl5hdM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x6swus2h1h89hse1lzfy.png" alt="Fallback cases" width="644" height="628"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Loop Control flow&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keywords

&lt;ul&gt;
&lt;li&gt;for/empty&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Old Syntax&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--j6NXwkV3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/875o6byihhy5fko51scf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j6NXwkV3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/875o6byihhy5fko51scf.png" alt="for loop new syntax" width="800" height="551"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;New Syntax&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_Ej2M_6_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/baspmssndln1llqmneo3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_Ej2M_6_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/baspmssndln1llqmneo3.png" alt="for loop old syntax" width="800" height="507"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Keynote:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;All structural directives are (proposed) syntax is introduced in the form of block &lt;code&gt;{ ... }&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Each structural directive has &lt;code&gt;#&lt;/code&gt; sign before starting block &lt;code&gt;{#&amp;lt;NAME_OF_DIRECTIVE&amp;gt;}&lt;/code&gt; in order to differentiate from HTML elements and Angular directives and ends with &lt;code&gt;&amp;lt;/&amp;lt;NAME_OF_DIRECTIVE&amp;gt;&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;New proposed syntax may/mayn't require parenthesis(optional( (&amp;lt;condition) for conditions due to surrounding braces of blocks.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Benefits:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Code is much clear and compact compare to old syntax.&lt;/li&gt;
&lt;li&gt;Multiple conditions with keywords can be applied.&lt;/li&gt;
&lt;li&gt;Improves DX and helps to improve and maintain code from future perspective.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Conclusion: 📝
&lt;/h4&gt;

&lt;p&gt;The proposed built-in control flow syntax for Angular templates represents a major step forward in improving DX by addressing the weaknesses of the existing micro-syntax.&lt;/p&gt;

&lt;p&gt;Therefore Angular team as &lt;strong&gt;proposed&lt;/strong&gt; new CFS syntax for template to support the &lt;strong&gt;zone/zoneless(signal)&lt;/strong&gt; based applications and also trying to achieve better &lt;strong&gt;Developer Experience (DX)&lt;/strong&gt; and try to be as close to &lt;code&gt;JS/TS/Framework&lt;/code&gt; syntax to avoid confusion and cluttering in templates. &lt;/p&gt;

&lt;p&gt;Hopefully &lt;a href="https://github.com/angular/angular/discussions/50719"&gt;RFC&lt;/a&gt; will be closed and final summary would be posted before it gets out in &lt;strong&gt;Angular v17&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let me know your thoughts via comments and feedback. 💬&lt;/p&gt;

&lt;p&gt;Happy coding and Happy Learning! 🚀🚀&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How do you differentiate Junior/Mid/Senior developer?</title>
      <dc:creator>khizerrehandev</dc:creator>
      <pubDate>Sun, 23 Jul 2023 12:03:32 +0000</pubDate>
      <link>https://dev.to/khizerrehandev/how-do-you-differentiate-juniormidsenior-developer-4894</link>
      <guid>https://dev.to/khizerrehandev/how-do-you-differentiate-juniormidsenior-developer-4894</guid>
      <description>&lt;p&gt;After talking to many experienced Engineers from all ranges varies from 2-14 years of experience and based on response that has &lt;br&gt;
been received i have compiled the characteristics that is the&lt;br&gt;
major differentiater between 3 roles.&lt;/p&gt;

&lt;h2&gt;
  
  
  Questions?
&lt;/h2&gt;

&lt;p&gt;Q1: Do you think having &lt;code&gt;n&lt;/code&gt; number of years of experince makes you an SENIOR Software engineer?&lt;br&gt;
Q2: Do you think having enough technical knowledge is what makes you an SENIOR Software engineer?&lt;br&gt;
Q3: Do you think becoming a manager and lead what make you SENIOR Software engineer?&lt;br&gt;
Q4: Do you think getting job done and JUST shiping code to production is what makes you SENIOR Software engineer?&lt;br&gt;
Q5: Do you think getting attending meetings with (Stakeholder/PM) what make you SENIOR Software engineer?&lt;br&gt;
Q6: Do you think just delegating your work to juniors make you SENIOR Software engineer?&lt;/p&gt;

&lt;p&gt;then IMHO, you can't say that you are SENIOR.&lt;/p&gt;

&lt;p&gt;Personally, i believe and even asking from smart engineer almost 80% SE has said the good characteristics&lt;br&gt;
for senior engineer/lead/manager (irrespective of role) is &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;He/She should be good communicator and listener.&lt;/li&gt;
&lt;li&gt;He/She been able to understand business requirements very well and translate those requirements down in the hierarchy to get things done what is required.&lt;/li&gt;
&lt;li&gt;He/She keeps himself up-to date with technical/non-technical knowledge.&lt;/li&gt;
&lt;li&gt;He/She should develop a habit to mentorship, knowledge sharing session with teams. Documenting things should be done and making sure things should be understood by person in his/her team.&lt;/li&gt;
&lt;li&gt;He/She should get knowledge of other domains in case leading teams with people having diverse tech background and level of understanding should be done to such extent that you can able effectively discuss/understand their technical jargons.&lt;/li&gt;
&lt;li&gt;Try to keep meeting short avoid unnecessary meetings because TIME is very important for your team.&lt;/li&gt;
&lt;li&gt;He/She should foster the culture to ask questions in order to bridge the gap between junior/senior (interms of technical debt).&lt;/li&gt;
&lt;li&gt;He/She motivate the team member in their job. Irrespective how small/large work is accomplished. It not only gives respect to his
member but also build a relationship to do things better way next time. &lt;/li&gt;
&lt;li&gt;He/She should take ownership with big roles their is big responsibility so utilize it in proper way and showcase your abilities 
through output.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;let me know your thoughts and comments. What do you think what are the characteristics that a make a developer a senior?&lt;/p&gt;

</description>
      <category>softwareengineer</category>
      <category>sharing</category>
      <category>thoughts</category>
    </item>
    <item>
      <title>Understanding ng-template, ng-container, *ngTemplateOutlet directive in Angular (ng-🚀)</title>
      <dc:creator>khizerrehandev</dc:creator>
      <pubDate>Sat, 15 Jul 2023 16:14:14 +0000</pubDate>
      <link>https://dev.to/khizerrehandev/understanding-ng-template-ng-container-ngtemplateoutlet-directive-in-angular-ng--568f</link>
      <guid>https://dev.to/khizerrehandev/understanding-ng-template-ng-container-ngtemplateoutlet-directive-in-angular-ng--568f</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnlsfqsdvck444aiuvcti.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnlsfqsdvck444aiuvcti.png" alt="Angular Template Fundamentals"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's always valuable to understand a few technical jargons and understand how multiple components can be combined or put together to build larger applications that have complex functionalities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is EmbeddedView&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As per Angular &lt;a href="https://angular.io/api/core/EmbeddedViewRef" rel="noopener noreferrer"&gt;docs&lt;/a&gt; states "&lt;em&gt;An embedded view can be referenced from a component other than the hosting component whose template defines it..."&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;A embedded view is basically a way of dynamically showing a template of another component within another component's template &lt;strong&gt;OR&lt;/strong&gt; It it allows to create a template as a part of host component's template.&lt;/p&gt;

&lt;p&gt;I am sure you might be &lt;strong&gt;confused&lt;/strong&gt; at this point let's divide into 2 parts:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;part-1:&lt;/strong&gt; "within another component's template..." &lt;/p&gt;

&lt;p&gt;Let's have 2 components &lt;strong&gt;Child-A&lt;/strong&gt; and &lt;strong&gt;Child-B&lt;/strong&gt; as separate angular components &lt;code&gt;(ts/html/css|scss)&lt;/code&gt;. So In order to create embedded view (dynamic creation) of a component template conditionally it can be achieved via structural directive.&lt;/p&gt;

&lt;p&gt;So It is as simple to embed a template or dynamically create template view into another component template &lt;strong&gt;e.g Parent component&lt;/strong&gt; template. Yes that's it 🎈🎉🥳&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Template defined as part of another component.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;

&lt;span class="c"&gt;&amp;lt;!-- Parent component template --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;header&amp;gt;&lt;/span&gt;Header&lt;span class="nt"&gt;&amp;lt;/header&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- Content Section --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"content"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;app-child-A&lt;/span&gt; &lt;span class="na"&gt;*ngIf=&lt;/span&gt;&lt;span class="s"&gt;"&amp;lt;condition-1&amp;gt;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/app-child-A&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;app-child-B&lt;/span&gt; &lt;span class="na"&gt;*ngIf=&lt;/span&gt;&lt;span class="s"&gt;"&amp;lt;condition-2&amp;gt;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/app-child-B&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;part-2:&lt;/strong&gt; "template as part of host" template..." &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Defined &lt;em&gt;independently&lt;/em&gt; by a &lt;code&gt;TemplateRef&lt;/code&gt; with in &lt;strong&gt;Host&lt;/strong&gt; component.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;

&lt;span class="c"&gt;&amp;lt;!-- Parent component template --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;header&amp;gt;&lt;/span&gt;Header&lt;span class="nt"&gt;&amp;lt;/header&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;ng-container&lt;/span&gt; &lt;span class="na"&gt;*ngTemplateOutlet=&lt;/span&gt;&lt;span class="s"&gt;"logoTpl"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/ng-container&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- Content Section --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"content"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    ...
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;footer&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;ng-container&lt;/span&gt; &lt;span class="na"&gt;*ngTemplateOutlet=&lt;/span&gt;&lt;span class="s"&gt;"logoTpl"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/ng-container&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/footer&amp;gt;&lt;/span&gt;


&lt;span class="c"&gt;&amp;lt;!-- Embedded View Template --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;ng-template&lt;/span&gt; &lt;span class="na"&gt;#logoTpl&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"path"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"logo image"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/ng-template&amp;gt;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Here it was defined as part of Hosting component template using "TemplateRef" variable without being tied to specific another component template. &lt;/p&gt;

&lt;p&gt;ℹ️ &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TemplateRef is denoted via &lt;strong&gt;#pound/hash&lt;/strong&gt; sign on 
```html
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;br&gt;
...&lt;br&gt;
&amp;lt;/ng-template&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- TemplateRef can be accessed via ViewChild and can be programatically create embedded view with in Host container ref. [Playground Stackblitz](https://stackblitz.com/edit/angular-create-embedded-view-6gfcn7b?file=src%2Fapp%2Fapp.component.ts)

Embedded View basically promotes building complex and interactive features by composing smaller, reusable building blocks by referencing **reusable** templates defined either in host component or tied to separate component.

Here's a basic example to illustrate the concept:

- [`*ngFor`](https://angular.io/api/core/EmbeddedViewRef#usage-notes)

```html


Count: {{items.length}}
&amp;lt;ul&amp;gt;
  &amp;lt;li *ngFor="let  item of items"&amp;gt;{{item}}&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;*ngFor&lt;/code&gt; directive represents an embedded view, and it is responsible for generating and managing the repeated HTML markup.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ngSwitch&lt;/code&gt; &lt;a href="https://angular.io/api/common/NgSwitch#usage-examples" rel="noopener noreferrer"&gt;Examples&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;

&lt;span class="nt"&gt;&amp;lt;container-element&lt;/span&gt; &lt;span class="na"&gt;[ngSwitch]=&lt;/span&gt;&lt;span class="s"&gt;"switch_expression"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- the same view can be shown in more than one case --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;some-element&lt;/span&gt; &lt;span class="na"&gt;*ngSwitchCase=&lt;/span&gt;&lt;span class="s"&gt;"match_expression_1"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;...&lt;span class="nt"&gt;&amp;lt;/some-element&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;some-element&lt;/span&gt; &lt;span class="na"&gt;*ngSwitchCase=&lt;/span&gt;&lt;span class="s"&gt;"match_expression_2"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;...&lt;span class="nt"&gt;&amp;lt;/some-element&amp;gt;&lt;/span&gt;
...
  &lt;span class="c"&gt;&amp;lt;!--default case when there are no matches --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;some-element&lt;/span&gt; &lt;span class="na"&gt;*ngSwitchDefault&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;...&lt;span class="nt"&gt;&amp;lt;/some-element&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/container-element&amp;gt;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;*ngSwitchCase&lt;/code&gt; directive represents an embedded view, and it is responsible for generating and managing the dynamic HTML markup.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Advantages of embedded view:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Flexibility for customisation by passing context data&lt;/li&gt;
&lt;li&gt;Reusability to avoid code duplication&lt;/li&gt;
&lt;li&gt;Code Clarity/Clean helps to keep template clear, concise &lt;/li&gt;
&lt;li&gt;Easy to Maintain from future perspective.&lt;/li&gt;
&lt;li&gt;Structural directives can play role to show/hide based on conditional rendering to make customised UI based on conditions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;ng-template&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Have you heard about &lt;strong&gt;&lt;code&gt;template&lt;/code&gt;&lt;/strong&gt; tag in HTML5. The purpose of  tag is if you have some HTML code you want to use repeatedly but not rendered &lt;em&gt;until you ask&lt;/em&gt; for it to to create view.&lt;/p&gt;

&lt;p&gt;Similarly Angular provides powerful built in tag exported from &lt;code&gt;CommonModule&lt;/code&gt; called &lt;code&gt;ng-template&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Think of ng-template as a &lt;strong&gt;blueprint&lt;/strong&gt; for creating something. It's like a mold or class from &lt;strong&gt;OOP&lt;/strong&gt; perspective that you can use to make multiple copies of an object within a document. &lt;/p&gt;

&lt;p&gt;It act as placeholder where static/dynamic reusable HTML markup can placed and based on context passed to &lt;code&gt;ng-template&lt;/code&gt; dynamic content + based on condition blueprint copies view can be created.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Static content
```html
&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Success message!&lt;/p&gt;
&lt;br&gt;



&lt;p&gt;Default message.&lt;/p&gt;
&lt;br&gt;




&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
- Passing context to ng-template
```ts


const data = {
 name: 'Khizer'
 title: 'Web Developer{% raw %}`
}
```

```html
&amp;lt;!-- Syntax-1 --&amp;gt;
&amp;lt;ng-container *ngTemplateOutlet="customTpl; context: {$implicit: data}"&amp;gt;&amp;lt;/ng-container&amp;gt;

&amp;lt;!-- Syntax-2 --&amp;gt;
&amp;lt;ng-template [ngTemplateOutlet]="customTpl" [ngTemplateOutletContext]="{$implicit: data}"

&amp;lt;ng-template #customTpl let-data&amp;gt;
  &amp;lt;div&amp;gt;{{ data.name }}&amp;lt;/div&amp;gt;
  &amp;lt;p&amp;gt;{{ data.title }}&amp;lt;/p&amp;gt;
&amp;lt;/ng-template&amp;gt;

```

**ng-container**

A special element that is provided by Angular to group or bind HTML markup together. Think it as **Imaginary box/container** which groups HTML element together

**Key Benefits/Usages of ng-container**

- **Grouping Element:** in order to apply structural directives `ngIf`, `ngFor`, or `ngSwitch` in order to render content based on conditions + It doesn't Produce any **extra** DOM element HTML markup DOM which serve the best purpose and hold things togther without adding something and creating chaos in DOM

- **Multiple directives can be applied:**

⚠️ _Angular docs: Multiple structural directives cannot be used on the same element [Read here](https://angular.io/api/core/ng-container#combination-of-multiple-structural-directives). If you need to take advantage of more than **one** structural directive, it is advised to use `&amp;lt;ng-container&amp;gt;` per structural directive._

Note: nesting containers are used to apply conditional logic

```html
&amp;lt;div *ngFor="let group of groups"&amp;gt;
  ...
  &amp;lt;ng-container *ngIf="&amp;lt;condition-1&amp;gt;"&amp;gt;
      &amp;lt;ng-container *ngFor="&amp;lt;condition-2&amp;gt;"&amp;gt;
         &amp;lt;ng-container *ngFor="&amp;lt;condition-3&amp;gt;"&amp;gt;
          ... These nesting conditions can be applied ... 
         &amp;lt;/ng-container&amp;gt;
      &amp;lt;/ng-container&amp;gt;
  &amp;lt;/ng-container&amp;gt;
&amp;lt;/div&amp;gt;
```

- **Creating container scope:**
`ng-container` creates a new variable scope, meaning any variables or context defined within an `ng-container` are only accessible within that container or immediate children HTML markup. Think like a functional scope
when you declare/define a function anything defined there is respect to that scope so Global scope variables can be accessed inside but not the **vice-versa**

Here's an example usage of `ng-container`:

```html
&amp;lt;div *ngIf="condition"&amp;gt;
  &amp;lt;ng-container *ngFor="let val of values"&amp;gt;
    &amp;lt;p&amp;gt;{{ val }}&amp;lt;/p&amp;gt;
  &amp;lt;/ng-container&amp;gt;
&amp;lt;/div&amp;gt;
```

**ngTemplateOutlet**

`ngTemplateOutlet` is a directive used to render the content of an `ng-template` at a specific location in the template. It allows you to dynamically render a template referenced by its template variable or template reference.

**1. Template declaration/definition:**

_Note:_ By default it is not rendered you need to explicitly need to inject or render the dynamic embedded view through multiple ways in order to create and stamp HTML markup in DOM.

```html
&amp;lt;ng-template #myTemplate&amp;gt;
  &amp;lt;p&amp;gt;I am a template and can be rendered any place!&amp;lt;/p&amp;gt;
&amp;lt;/ng-template&amp;gt;
```
**Template Rendering**

In order to render the template, you use the `ngTemplateOutlet` directive on an element within the template where you want the content to be rendered.
You reference the `ng-template` by its template reference `#variable`

```html
&amp;lt;div [ngTemplateOutlet]="myTemplate"&amp;gt;&amp;lt;/div&amp;gt;

or

&amp;lt;ng-container [ngTemplateOutlet]="myTemplate"&amp;gt;&amp;lt;/ng-container&amp;gt;
```

**2. Pass Contextual data:** You can also pass contextual data to the template being rendered by using the 

You can even pass context to template to the template by using `[ngTemplateOutletContext]` input. It allows you to provide additional variables or data that can be accessed within the template.

`ngTemplateOutlet`.It provides a powerful mechanism for creating flexible and customizable components and enhancing code modularity and reusability.

**4. Repeating/Reusability:** You can use to create embedded view multiple times e.g 5 instance are created 

```html
&amp;lt;ng-container *ngTemplateOutlet="repeatTpl"&amp;gt;&amp;lt;/ng-container&amp;gt;
&amp;lt;ng-container *ngTemplateOutlet="repeatTpl"&amp;gt;&amp;lt;/ng-container&amp;gt;
&amp;lt;ng-container *ngTemplateOutlet="repeatTpl"&amp;gt;&amp;lt;/ng-container&amp;gt;
&amp;lt;ng-container *ngTemplateOutlet="repeatTpl"&amp;gt;&amp;lt;/ng-container&amp;gt;
&amp;lt;ng-container *ngTemplateOutlet="repeatTpl"&amp;gt;&amp;lt;/ng-container&amp;gt;

&amp;lt;ng-template #repeatTpl&amp;gt;
 &amp;lt;h2&amp;gt; Repeatable content &amp;lt;/h2&amp;gt;
&amp;lt;/ng-template&amp;gt;

```

I am sure there is something you have learned tutorial and understanding these complex terms. Which i am sure it will be clear and hopefully will help you to build more modular templates and making your code much less cluttered. 

Let me know your thoughts via comments and feedback. 💬

Happy coding and Happy Learning! 🚀🚀
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>angular</category>
      <category>bestpractices</category>
      <category>angulartemplates</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Demystifying Reactive Programming with RxJS</title>
      <dc:creator>khizerrehandev</dc:creator>
      <pubDate>Thu, 06 Jul 2023 15:08:56 +0000</pubDate>
      <link>https://dev.to/khizerrehandev/demystifying-reactive-programming-with-rxjs-312l</link>
      <guid>https://dev.to/khizerrehandev/demystifying-reactive-programming-with-rxjs-312l</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KM87cuHq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4mtk9rs0siimmubpd3jf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KM87cuHq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4mtk9rs0siimmubpd3jf.png" alt="RxJS" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Reactive programming has become increasingly popular in modern web development due to its ability to handle complex asynchronous operations and provide a more declarative approach to managing data streams. At the forefront of this paradigm is RxJS, a powerful library that implements reactive programming principles in JavaScript. In this article, we'll dive into the world of RxJS, explore its core concepts, and demonstrate how it can revolutionize your codebase. So let's get started!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Understanding Reactive Programming&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Reactive programming is centered around the idea of modeling the flow of data and events as observable sequences. These sequences can be created from various sources such as user inputs, HTTP requests, or even timers. RxJS provides a set of tools and operators that enable developers to compose, transform, and manipulate these sequences effortlessly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Observable and Observer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The fundamental building blocks of RxJS are observables and observers. An observable represents a stream of values over time, while an observer is responsible for subscribing to an observable and reacting to the emitted values. Let's take a look at a simple example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Observable&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;rxjs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;observable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Observable&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;observer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;observer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Value 1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;observer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Value 2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;observer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;complete&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;observer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;next&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;complete&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Complete&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nx"&gt;observable&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;observer&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we create an observable that emits the values &lt;code&gt;'Value 1'&lt;/code&gt; and &lt;code&gt;'Value 2'&lt;/code&gt; and then completes. The observer object defines three methods: &lt;code&gt;next&lt;/code&gt;, &lt;code&gt;error&lt;/code&gt;, and &lt;code&gt;complete&lt;/code&gt;. When we subscribe to the observable, these methods are invoked accordingly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operators&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;RxJS provides a rich collection of operators that allow you to transform, filter, combine, conditional, and control the behavior of observables. These operators enable you to build powerful data pipelines with concise and readable code. Let's see an example that demonstrates the &lt;code&gt;map&lt;/code&gt; and &lt;code&gt;filter&lt;/code&gt; operators:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;rxjs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;filter&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;rxjs/operators&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;numbersObservable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;numbersObservable&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we create an observable &lt;code&gt;numbersObservable&lt;/code&gt; with values &lt;code&gt;1&lt;/code&gt; to &lt;code&gt;5&lt;/code&gt;. Then we apply the &lt;code&gt;map&lt;/code&gt; operator to double each value and the &lt;code&gt;filter&lt;/code&gt; operator to only keep values greater than &lt;code&gt;5&lt;/code&gt;. Finally, we subscribe to the transformed observable and log the resulting values (&lt;code&gt;6&lt;/code&gt;, &lt;code&gt;8&lt;/code&gt;, &lt;code&gt;10&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits of RxJS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Using RxJS in your projects brings several benefits:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Simplified Asynchronous Programming&lt;/strong&gt;: RxJS allows you to handle complex asynchronous operations with ease. It provides a consistent and unified approach to dealing with event-driven systems, making your code more maintainable and less error-prone.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Declarative Programming&lt;/strong&gt;: With RxJS, you can express complex data flows using a declarative style. The powerful operators enable you to easily compose and transform data streams, resulting in code that is more readable and expressive.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Efficient Data Handling&lt;/strong&gt;: RxJS optimizes the processing of data streams by providing built-in techniques for managing backpressure and concurrency. This ensures efficient memory usage and prevents overwhelming your system with excessive data.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>rxjs</category>
      <category>reactivity</category>
    </item>
  </channel>
</rss>
