<?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: Ahmed Osama Bedawy</title>
    <description>The latest articles on DEV Community by Ahmed Osama Bedawy (@ahmeddoosama).</description>
    <link>https://dev.to/ahmeddoosama</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%2F424602%2Fd65f9867-20af-4c77-8053-b2c772e208e3.jpeg</url>
      <title>DEV Community: Ahmed Osama Bedawy</title>
      <link>https://dev.to/ahmeddoosama</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ahmeddoosama"/>
    <language>en</language>
    <item>
      <title>Dependency Inversion Principle (DIP)</title>
      <dc:creator>Ahmed Osama Bedawy</dc:creator>
      <pubDate>Sun, 21 Jan 2024 16:13:26 +0000</pubDate>
      <link>https://dev.to/ahmeddoosama/dependency-inversion-principle-dip-2joj</link>
      <guid>https://dev.to/ahmeddoosama/dependency-inversion-principle-dip-2joj</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is the Dependency Inversion Principle?&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The Dependency Inversion Principle (DIP) is one of the five SOLID principles that states:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;High-level modules should not depend on low-level modules.
Both should depend on abstractions.&lt;/li&gt;
&lt;li&gt;Abstractions should not depend on details. Details should depend on abstractions.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let’s break this down by examples.&lt;/p&gt;

&lt;p&gt;In this example: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcusaqr6twtnfr5but6uo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcusaqr6twtnfr5but6uo.png" alt="Image description" width="800" height="461"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;High-level Module(or Class)&lt;/strong&gt;: Class that executes an action with a tool.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Low-level Module (or Class)&lt;/strong&gt;: The tool that is needed to execute the action.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Abstraction&lt;/strong&gt;: Represents an interface that connects the two Classes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Details&lt;/strong&gt;: How the tool works.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Another example &lt;strong&gt;Vehicle&lt;/strong&gt; and &lt;strong&gt;Engine&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Without &lt;strong&gt;DIP&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;Vehicle&lt;/code&gt; class directly instantiates a specific &lt;code&gt;Engine&lt;/code&gt; class (e.g., &lt;code&gt;PetrolEngine&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;Vehicle&lt;/code&gt; depends on concrete details of &lt;code&gt;PetrolEngine&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With &lt;strong&gt;DIP&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Introduce an abstraction:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create an interface Engine with methods like &lt;code&gt;start()&lt;/code&gt; 
and &lt;code&gt;stop()&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Refactor &lt;code&gt;Vehicle&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; &lt;code&gt;Vehicle&lt;/code&gt; depend on the &lt;code&gt;Engine&lt;/code&gt; interface instead of a 
concrete &lt;code&gt;Engine&lt;/code&gt; class.&lt;/li&gt;
&lt;li&gt;Inject a concrete &lt;code&gt;Engine&lt;/code&gt; implementation (e.g., 
&lt;code&gt;PetrolEngine&lt;/code&gt; or &lt;code&gt;ElectricEngine&lt;/code&gt;) at runtime.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Enhanced flexibility&lt;/strong&gt;: Change engine types without modifying &lt;code&gt;Vehicle&lt;/code&gt; code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Easier testing&lt;/strong&gt;: Mock Engine for testing &lt;code&gt;Vehicle&lt;/code&gt; in isolation.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;This principle says a Class should not be fused with the tool it uses to execute an action. Rather, it should be fused to the interface that will allow the tool to connect to the Class.&lt;/p&gt;

&lt;p&gt;It also says that both the Class and the interface should not know how the tool works. However, the tool needs to meet the specifications of the interface.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>oop</category>
      <category>solidprinciples</category>
      <category>dependencyinversion</category>
      <category>dip</category>
    </item>
    <item>
      <title>100+ Questions for Angular Interviews 💫</title>
      <dc:creator>Ahmed Osama Bedawy</dc:creator>
      <pubDate>Tue, 28 Nov 2023 22:32:56 +0000</pubDate>
      <link>https://dev.to/ahmeddoosama/100-questions-for-frontend-interviews-j86</link>
      <guid>https://dev.to/ahmeddoosama/100-questions-for-frontend-interviews-j86</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;100+ Questions for Frontend Interviews 💫&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Angular Interview Questions:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub Repo: &lt;a href="https://t.ly/gXvx8"&gt;https://t.ly/gXvx8&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Simplilearn: &lt;a href="https://rb.gy/1kci32"&gt;https://rb.gy/1kci32&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;DZone: &lt;a href="https://rb.gy/hqqyjt"&gt;https://rb.gy/hqqyjt&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Codecademy: &lt;a href="https://rb.gy/00o7yj"&gt;https://rb.gy/00o7yj&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Flexiple: &lt;a href="https://rb.gy/tqeopw"&gt;https://rb.gy/tqeopw&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Educative: &lt;a href="https://rb.gy/jtg2hw"&gt;https://rb.gy/jtg2hw&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Rxjs Interview Questions:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;javatpoint: &lt;a href="https://t.ly/ZDyJa"&gt;https://t.ly/ZDyJa&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Indeed: &lt;a href="https://t.ly/ZfwVC"&gt;https://t.ly/ZfwVC&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;SkillCombo: &lt;a href="https://t.ly/LjE49"&gt;https://t.ly/LjE49&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;TechGeekNext: &lt;a href="https://t.ly/YCr4h"&gt;https://t.ly/YCr4h&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Fullstack.cafe: &lt;a href="https://cutt.ly/dwOgdRhL"&gt;https://cutt.ly/dwOgdRhL&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;TypeScript Interview Questions:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;InterviewBit: &lt;a href="https://cutt.ly/BwOggef1"&gt;https://cutt.ly/BwOggef1&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Edureka: &lt;a href="https://cutt.ly/pwOggmdx"&gt;https://cutt.ly/pwOggmdx&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Hackr: &lt;a href="https://lnkd.in/dTQ3skJS"&gt;https://lnkd.in/dTQ3skJS&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Simplilearn: &lt;a href="https://lnkd.in/drW3Tuz8"&gt;https://lnkd.in/drW3Tuz8&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Educative: &lt;a href="https://lnkd.in/dStJPhPV"&gt;https://lnkd.in/dStJPhPV&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Javascript Interview Questions:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub Repo: &lt;a href="https://lnkd.in/dWiBhWxp"&gt;https://lnkd.in/dWiBhWxp&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;InterviewBit: &lt;a href="https://lnkd.in/dJyDWsu9"&gt;https://lnkd.in/dJyDWsu9&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Guru99: &lt;a href="https://lnkd.in/dEAKXrkP"&gt;https://lnkd.in/dEAKXrkP&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Hackr: &lt;a href="https://lnkd.in/dsceyNye"&gt;https://lnkd.in/dsceyNye&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;javatpoint: &lt;a href="https://lnkd.in/dnbdi23F"&gt;https://lnkd.in/dnbdi23F&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>javascript</category>
      <category>angular</category>
      <category>typescript</category>
      <category>interview</category>
    </item>
    <item>
      <title>Forms in Angular</title>
      <dc:creator>Ahmed Osama Bedawy</dc:creator>
      <pubDate>Sat, 05 Feb 2022 14:38:53 +0000</pubDate>
      <link>https://dev.to/ahmeddoosama/forms-in-angular-3m11</link>
      <guid>https://dev.to/ahmeddoosama/forms-in-angular-3m11</guid>
      <description>&lt;p&gt;&lt;em&gt;&amp;gt; Angular provides to different approaches to handling user input through forms: reactive forms &amp;amp; template-driven forms.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Reactive forms and template driven forms each of them has different advantages when mange form data.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reactive forms ⇒&lt;/strong&gt; Provide direct, explicit access to underlying forms object model, they’re more scalable, reusable, and testable. If you work in large project and the form are a key part of your application, &lt;strong&gt;use reactive forms&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Template-driven forms ⇒&lt;/strong&gt; depend on directive in the template to create and manipulate the underlying object model. If you have very basic form requirements and logic, template-driven form could be a good fit.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This table show the key difference between reactive and template-driven forms.&lt;/p&gt;

&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%2Fqnirqw5i1kk94sldikob.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%2Fqnirqw5i1kk94sldikob.PNG" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Scalability:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If the forms is essential part of your project, scalability is very important.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reactive forms ⇒&lt;/strong&gt; It’s are more scalable than template-driven forms. They provide direct access to the underlying from API, and use synchronous data flow between the view and data model, which makes creating large-scale forms easier.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Template-driven forms ⇒&lt;/strong&gt; It’s are less scalable than reactive forms. They abstract away the underlying from API, and use async data flow between the view and the data model.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Setup and data flow in reactive forms:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In reactive forms, you define the form model directly in the component class. The formControl directive links the explicitly created formControl instance to a specific form element in the view.&lt;/p&gt;

&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%2Ffwnut4nb0v7jhrdc8lac.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%2Ffwnut4nb0v7jhrdc8lac.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; In this figure, you will see the formcontrol directive links directly to form element in the view.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; Data Flow:&lt;/strong&gt;&lt;br&gt;
In reactive forms the updates from the view to the model and from the model to the view are synchronous and do not depend on how the UI is rendered.&lt;/p&gt;

&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%2Fdcufk6j6bbcjbwnoe875.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%2Fdcufk6j6bbcjbwnoe875.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; Data flow form the view to the model&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this figure show how data flow changed from the view to model through the following steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A value is typed by the user into the input element. In this example the value is &lt;code&gt;blue.&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The form input element emits an “input” event with the latest value.&lt;/li&gt;
&lt;li&gt;The control value accessor listening for events on the form input element immediately relays the new value to the &lt;code&gt;formControl&lt;/code&gt; instance.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;formControl&lt;/code&gt; instance emits the new value through the &lt;strong&gt;&lt;code&gt;valueChanges&lt;/code&gt;&lt;/strong&gt; observable.&lt;/li&gt;
&lt;li&gt;The new value is received by any subscribers to the &lt;strong&gt;&lt;code&gt;valueChanges&lt;/code&gt;&lt;/strong&gt; observable.&lt;/li&gt;
&lt;/ol&gt;

&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%2Ff98q5s9hrsz98i9wq818.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%2Ff98q5s9hrsz98i9wq818.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; Data flow form the model to the view&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this figure show how data flow changed from the model to view through the following steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The user calls the &lt;code&gt;favoriteColorControl.setValue()&lt;/code&gt; method, which updates the &lt;code&gt;FormControl&lt;/code&gt; value.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;FormControl&lt;/code&gt; instance emits the new value through the &lt;code&gt;valueChanges&lt;/code&gt; observable.&lt;/li&gt;
&lt;li&gt;Any subscribers to the &lt;code&gt;valueChanges&lt;/code&gt; observable receive the new value.&lt;/li&gt;
&lt;li&gt;The control value accessor on the form input element updates the element with the new value.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Setup and data flow in template-driven forms:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In template-driven forms, the form model is implicit. The directive NgModel creates and manages a FormControl instance for a given form element.&lt;/p&gt;

&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%2Fetua2cpeta2trem2bze7.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%2Fetua2cpeta2trem2bze7.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; In a template-driven form the source of truth is the template. You do not have direct programmatic access to the FormControl instance.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Data Flow:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In template-driven forms, each form element is linked to a directive that manages the form model internally.&lt;/p&gt;

&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%2Fpuy9s9heypow16oyx8zh.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%2Fpuy9s9heypow16oyx8zh.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; Data Flow from View to Model&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this figure show how data flow changed from the view to model through the following steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A value(Blue) is typed by the user into the input element.&lt;/li&gt;
&lt;li&gt;An “input” event having the new value is emitted by the input element.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;setValue()&lt;/code&gt; method on the &lt;code&gt;FormControl&lt;/code&gt; instance is triggered by the control value accessor attached to the input.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;FormControl&lt;/code&gt; instance emits the new value through the &lt;code&gt;valueChanges&lt;/code&gt; observable.&lt;/li&gt;
&lt;li&gt;Any subscribers to the &lt;code&gt;valueChanges&lt;/code&gt; observable receive the new value.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;NgModel.viewToModelUpdate()&lt;/code&gt; method is also called by the control value accessor. It emits an &lt;code&gt;ngModelChange&lt;/code&gt; event.&lt;/li&gt;
&lt;li&gt;For the defined property, the component template uses two-way data binding. The value emitted by the &lt;code&gt;ngModelChange&lt;/code&gt; event is used to update the defined property in the component.&lt;/li&gt;
&lt;/ol&gt;

&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%2Fbz0p8u4zjyk67sbt0d2c.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%2Fbz0p8u4zjyk67sbt0d2c.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; Data Flow from Model to View&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this figure show how data flow changed from the model to view through the following steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The defined property is updated to a new value in the component.&lt;/li&gt;
&lt;li&gt;The Change detection then starts.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;ngOnChanges&lt;/code&gt; lifecycle hook is called on the &lt;code&gt;NgModel&lt;/code&gt; directive instance during the change detection. The reason being that the value of one of its inputs has changed.&lt;/li&gt;
&lt;li&gt;An async task is queued by the &lt;code&gt;ngOnChanges()&lt;/code&gt; method to set the value for the internal &lt;code&gt;FormControl&lt;/code&gt; instance.&lt;/li&gt;
&lt;li&gt;The Change detection is now completed.&lt;/li&gt;
&lt;li&gt;To set the &lt;code&gt;FormControl&lt;/code&gt; instance value, the required task is executed.&lt;/li&gt;
&lt;li&gt;The latest value is emitted by the &lt;code&gt;FormControl&lt;/code&gt; instance through the &lt;code&gt;valueChanges&lt;/code&gt; observable.&lt;/li&gt;
&lt;li&gt;Any subscribers to the &lt;code&gt;valueChanges&lt;/code&gt; observable receive the new value.&lt;/li&gt;
&lt;li&gt;The control value accessor updates the form input element in the view with the latest value.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>angular</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
