<?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>Forem: Dimitar Stoev</title>
    <description>The latest articles on Forem by Dimitar Stoev (@dimitarstbc).</description>
    <link>https://forem.com/dimitarstbc</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%2F814317%2F334086c6-c0b0-468e-90f4-6e809ffb20b0.png</url>
      <title>Forem: Dimitar Stoev</title>
      <link>https://forem.com/dimitarstbc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/dimitarstbc"/>
    <language>en</language>
    <item>
      <title>Reactive Forms in Angular</title>
      <dc:creator>Dimitar Stoev</dc:creator>
      <pubDate>Wed, 31 May 2023 13:05:53 +0000</pubDate>
      <link>https://forem.com/dimitarstbc/reactive-forms-in-angular-3boh</link>
      <guid>https://forem.com/dimitarstbc/reactive-forms-in-angular-3boh</guid>
      <description>&lt;p&gt;I am yet to see an Angular application without some kind of a form. The power of Internet two is the ability to create user content and express ourselves. Nothing of that could happen without the communication between the front end and the back end technologies.&lt;/p&gt;

&lt;p&gt;I am not going to talk about protocols, network or REST. I am going to dive a little bit into the ways of Angular to collect the information.&lt;/p&gt;

&lt;p&gt;Two ways to do it - template driven and reactive forms.&lt;/p&gt;

&lt;p&gt;I am talking about Angular Reactive forms today.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the difference between template driven and reactive forms?
&lt;/h2&gt;

&lt;p&gt;Good question!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The name “&lt;strong&gt;template driven&lt;/strong&gt;” forms comes from the way they are structured. It follows a declarative approach where the form itself and the validations are defined in the HTML.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reactive forms&lt;/strong&gt; take a more programmatic approach, where you validate and define using TypeScript.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Template driven&lt;/strong&gt; forms use &lt;strong&gt;Two-way data binding&lt;/strong&gt; to communicate with their “model”&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reactive forms&lt;/strong&gt; use &lt;strong&gt;form controls that are treated as streams of data&lt;/strong&gt; - aka. &lt;strong&gt;Observables&lt;/strong&gt; that can be observed and reacted upon.&lt;/li&gt;
&lt;li&gt;Compared to Reactive forms, you have &lt;strong&gt;limited control with Template driven forms&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How do I prefer to use them?&lt;/p&gt;

&lt;p&gt;I find template driven forms useful in controlling the UI ( like a checkbox for example ). Conditional rendering based on some specific input.&lt;/p&gt;

&lt;p&gt;Less complex forms, although I am starting to switch to “Always reactive forms”.&lt;/p&gt;

&lt;p&gt;Reactive forms are easier to work with. Even though the set up is heavier and the complexity is a little bit more, Angular reactive forms are way too powerful and have to offer so much.&lt;/p&gt;

&lt;p&gt;Another thing I like more about Reactive forms is they tend to be more “structured”. It is strict and maintainable. I don’t have to look in the entire HTML template in order to find all I want.&lt;/p&gt;

&lt;p&gt;Controlling the entire form in the component class is just great. This is the way it should be.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up Reactive Forms
&lt;/h2&gt;

&lt;p&gt;In order to use the reactive forms you have to set up the module and import the dependencies.&lt;/p&gt;

&lt;p&gt;It is done through the ReactiveFormsModule from the @angular/forms. This provides all the necessary classes and functions for our reactive forms to work.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fiodsuyckm6ofz0k5bkm1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fiodsuyckm6ofz0k5bkm1.png" alt="Setting up Reactive Forms" width="800" height="247"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With this we will have the option to use some special binding such as formGroup, formGroupName, ngSubmit and more.&lt;/p&gt;

&lt;p&gt;One of the most important classes I am going to import is the FormBuilder. A class that comes with great features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;control ()&lt;/strong&gt; - you can create individual form control. It returns a &lt;strong&gt;FormControl&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;group ()&lt;/strong&gt; - this is the main method to create the form group.An object that utilizes the keys as form control names. It returns a &lt;strong&gt;FormGroup&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;array () - A method that returns a &lt;strong&gt;FormArray&lt;/strong&gt; instance. Incredibly powerful&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F96he4yx9stq5bnawbgaz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F96he4yx9stq5bnawbgaz.png" alt="FormBuilder" width="800" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can even nest FormGroups!&lt;/p&gt;

&lt;p&gt;But what exactly is Form Control and Form Groups?&lt;/p&gt;

&lt;h2&gt;
  
  
  FormControl
&lt;/h2&gt;

&lt;p&gt;This is the building block of reactive forms. It represents an individual input field within the form and tracks its value, validation status and every used interaction. &lt;/p&gt;

&lt;p&gt;One thing I want to mention is that &lt;strong&gt;FormControl&lt;/strong&gt; is a class that &lt;strong&gt;extends AbstractControl&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We bind it to the template with the &lt;strong&gt;formControlName&lt;/strong&gt; and use the correlated name or we just provide the entire control. It goes directly to the input element.&lt;/p&gt;

&lt;p&gt;Some useful methods I want to present to you are: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;valueChanges - observable that fires every time a value is changed&lt;/li&gt;
&lt;li&gt;setValue - sets a new value for the form control&lt;/li&gt;
&lt;li&gt;patchValue - &lt;strong&gt;it acts the same as setValue&lt;/strong&gt; when it comes to &lt;strong&gt;FormControls&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;updateOn - FormHooks that represents the update strategy&lt;/li&gt;
&lt;li&gt;setValidators, removeValidators - useful methods to control the validators of the FormControl&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What about FormGroups?
&lt;/h2&gt;

&lt;p&gt;While FormControl represents an individual input field, FormGroup allows you to group related form controls together. It allows you to manage the state, validation and values as a single entity.&lt;/p&gt;

&lt;p&gt;It is way easier to keep track of the validity of the entire form you have.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fath6w7plldxkinwmpnke.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fath6w7plldxkinwmpnke.png" alt="FormGroups" width="800" height="266"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How does it do it?&lt;/p&gt;

&lt;p&gt;While we instantiate the new FormControl we can provide some arguments in the constructor. One of them is the &lt;strong&gt;ValidatorFn&lt;/strong&gt;. A function that receives a control and synchronously returns a map of validation errors if present, otherwise null.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F4l9nstpd5pns4slmd7cl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F4l9nstpd5pns4slmd7cl.png" alt="ValidatorFn" width="800" height="247"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Form Builder
&lt;/h2&gt;

&lt;p&gt;A helper class provided by the Reactive Forms module that simplifies the entire process of building the form.&lt;/p&gt;

&lt;p&gt;It offers declarative ways to build complex forms.&lt;/p&gt;

&lt;p&gt;The most important method here is the &lt;strong&gt;group&lt;/strong&gt; - accepts an object which contains all the keys and corresponding inner control types. &lt;/p&gt;

&lt;p&gt;One other great feature is that &lt;strong&gt;we can dynamically create and modify form controls!&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Dynamic Forms
&lt;/h2&gt;

&lt;p&gt;Reactive forms just shine here!&lt;/p&gt;

&lt;p&gt;Let’s say we are building a form that needs to be dynamic. We need an address, but we are not sure how many addresses people have. What is the solution?&lt;/p&gt;

&lt;p&gt;We allow multiple ones.&lt;/p&gt;

&lt;p&gt;But how do we do it if we said we define the form itself in the FormBuilder.&lt;/p&gt;

&lt;p&gt;Easy. We use the power of arrays. FormArrays!&lt;/p&gt;

&lt;p&gt;That’s a class that represents an array of multiple &lt;strong&gt;FormGroups&lt;/strong&gt; or &lt;strong&gt;FormControls&lt;/strong&gt;. It also provides methods to add or remove such.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fjdm3easqxkxueajkwodd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fjdm3easqxkxueajkwodd.png" alt="Dynamic Forms" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The initial setup could be a little tricky if you are doing it for the first time. I remember it was a little bit confusing when I was trying to do it.&lt;br&gt;
We add controls with the &lt;strong&gt;push()&lt;/strong&gt; method and &lt;strong&gt;removeAt()&lt;/strong&gt; to .. well… to remove.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;console.log(address.at(0).value); // Access the value of a specific control&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Flow
&lt;/h2&gt;

&lt;p&gt;Let’s show the flow of creating everything in images. I guess it’s going to be useful to visualize it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;we import the reactive form module&lt;/li&gt;
&lt;li&gt;define the form builder&lt;/li&gt;
&lt;li&gt;create the form group&lt;/li&gt;
&lt;li&gt;set up arrays ( if any )&lt;/li&gt;
&lt;li&gt;bind to the HTML&lt;/li&gt;
&lt;li&gt;control the events and submission&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Easy!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fcu387dnaitzkswe4azfc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fcu387dnaitzkswe4azfc.png" alt="flow one" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F0vbdxvuz8vxw3ti5wrdd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F0vbdxvuz8vxw3ti5wrdd.png" alt="flow two" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F4begtslx9c5j9fqnqmgv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F4begtslx9c5j9fqnqmgv.png" alt="flow three" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Repository
&lt;/h2&gt;

&lt;p&gt;If you already follow me, you know there would be a repo with the code.&lt;/p&gt;

&lt;p&gt;Have a look here.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/dimitar-stoev/dimitar-stoev-tutorials/tree/reactive-forms" rel="noopener noreferrer"&gt;https://github.com/dimitar-stoev/dimitar-stoev-tutorials/tree/reactive-forms&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can check a &lt;strong&gt;custom Validation function&lt;/strong&gt;, set up based on my &lt;strong&gt;preferred Angular application structure&lt;/strong&gt; and more. &lt;/p&gt;

&lt;p&gt;Don’t forget to “&lt;strong&gt;star&lt;/strong&gt;” the project. It would be awesome!&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Reactive forms are the best way to handle complex logic and data.&lt;/p&gt;

&lt;p&gt;It’s my preferred way of creating user interactions. Although I sometimes use template driven forms, it’s on very rare occasions.&lt;/p&gt;

&lt;p&gt;Reactive forms are dynamic, reactive ( I know, I know ) and more declarative.&lt;/p&gt;

&lt;p&gt;Play around and find out!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>angular</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Creating Dynamic Components in Angular</title>
      <dc:creator>Dimitar Stoev</dc:creator>
      <pubDate>Sun, 14 May 2023 13:46:07 +0000</pubDate>
      <link>https://forem.com/dimitarstbc/creating-dynamic-components-in-angular-25bb</link>
      <guid>https://forem.com/dimitarstbc/creating-dynamic-components-in-angular-25bb</guid>
      <description>&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;p&gt;Hey, Angular fans, and &lt;/p&gt;

&lt;p&gt;Здравейте, приятели!&lt;/p&gt;

&lt;p&gt;I am diving more into Dynamic Components and the importance and crucial role they play in developing flexible Angular applications.&lt;/p&gt;

&lt;p&gt;I happened to “meet” them relatively late in my Angular career and as far as I see, there aren’t too many articles and content in general about it.&lt;/p&gt;

&lt;p&gt;So.. what is it?&lt;/p&gt;

&lt;p&gt;Why do we need it?&lt;/p&gt;

&lt;p&gt;When could we benefit from it?&lt;/p&gt;

&lt;p&gt;I am going to define the Dynamic Components for you and make a contrast to static components, highlighting their advantage and use case.&lt;/p&gt;

&lt;p&gt;Second - we will dive a little bit more on how to manage them.&lt;/p&gt;

&lt;p&gt;So what am I going to show you and build for you?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Foer6fowj6dzjr3zma9eg.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Foer6fowj6dzjr3zma9eg.gif" alt="project build" width="1920" height="1080"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Definition and Information
&lt;/h2&gt;

&lt;p&gt;The difference with standard components is that when we talk about dynamic ones, we mean they are not defined at build time, but at run time.&lt;/p&gt;

&lt;p&gt;This allows us to create components based on user input or dynamic data.&lt;/p&gt;

&lt;p&gt;They are not defined in the template, but rather rendered dynamically.&lt;/p&gt;

&lt;p&gt;Perfectly flexible and reusable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a Dynamic Component
&lt;/h2&gt;

&lt;p&gt;The initialization of the Dynamic Components is straightforward and you already know how to make one.&lt;/p&gt;

&lt;p&gt;You generate a component through the CLI and register it in a module as usual.&lt;/p&gt;

&lt;p&gt;Nothing new here!&lt;/p&gt;

&lt;p&gt;For components that I plan to use dynamically, I usually register them as standalone components.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fl0g15st1swp0iezaywbq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fl0g15st1swp0iezaywbq.png" alt="standalone component creation" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have talked to some people who thought that dynamic components are some special components, but that’s wrong.&lt;/p&gt;

&lt;p&gt;It’s the same component, just the way we render and create it is different.&lt;/p&gt;

&lt;p&gt;The component is just rendering information based on inputs.&lt;/p&gt;

&lt;p&gt;I know it’s nothing interesting, but it’s to get the idea.&lt;/p&gt;

&lt;p&gt;The HTML is as follows&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fqus9tt652kba1n48p9h8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fqus9tt652kba1n48p9h8.png" alt="HTML structure of component" width="800" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The basic “widget” component is looping through the config and displays the key as title and the value of information as paragraph.&lt;/p&gt;

&lt;p&gt;Beautiful, right?&lt;/p&gt;

&lt;p&gt;Now let’s go to the interesting part.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Flrmb8rowxg7wjl0vxwv3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Flrmb8rowxg7wjl0vxwv3.png" alt="creation of dynamic component" width="800" height="715"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have three buttons and every one of them calls the method of dynamic component creation for a certain type. Based on the type we “pull” the correct data. I am not going to use a service here and mock a response. Just simple constant data.&lt;/p&gt;

&lt;p&gt;Since we are grabbing the “container” we have to “clear” it in every call. If we don’t, we will end up with multiple components.&lt;/p&gt;

&lt;p&gt;Now let’s see what is “component” and “inputs”.&lt;/p&gt;

&lt;p&gt;We see that we are extracting the data from optionsByType().&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fjng2sc3nthw9eqg57hsh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fjng2sc3nthw9eqg57hsh.png" alt="options of component" width="800" height="604"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The powerful thing is you can load any type of component and any type of data. Making it truly dynamic.&lt;/p&gt;

&lt;p&gt;This is perfectly enough for Angular to create the component for us.&lt;/p&gt;

&lt;p&gt;You can check the repo listed below and see everything as it is.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use cases
&lt;/h2&gt;

&lt;p&gt;Using dynamic components depends on the situation. Some of the most real world use cases are&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dynamic Forms - creating a dynamic section or fields&lt;/li&gt;
&lt;li&gt;Modals | Dialogs - not every time a library is needed or sufficient&lt;/li&gt;
&lt;li&gt;Widgets - not as simple and stupid as the current app I am showing you ( I hope so )&lt;/li&gt;
&lt;li&gt;Data visualization - rendering different charts and data ( personal favorite )&lt;/li&gt;
&lt;li&gt;Conditional rendering - you can show components depending of the user input )&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Repository
&lt;/h2&gt;

&lt;p&gt;Dynamic Components are something that is not usually the first choice for many devs out there.&lt;/p&gt;

&lt;p&gt;You need to play with them in order to understand them relatively well.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/dimitar-stoev/dynamic-components" rel="noopener noreferrer"&gt;Here is the promised repo you can check&lt;/a&gt;. A simple “project”, but enough to get you started!&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>angular</category>
      <category>programming</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How I use NgTemplateOutlet in Angular - Part 1</title>
      <dc:creator>Dimitar Stoev</dc:creator>
      <pubDate>Sun, 07 May 2023 08:56:54 +0000</pubDate>
      <link>https://forem.com/dimitarstbc/how-i-use-ngtemplateoutlet-in-angular-part-1-2p8m</link>
      <guid>https://forem.com/dimitarstbc/how-i-use-ngtemplateoutlet-in-angular-part-1-2p8m</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This is a directive that is always neglected and people tend to not use it. Either because they do not fully understand the use cases or simply because they don’t know they exist. I have seen it! I know!&lt;/p&gt;

&lt;p&gt;When I first encountered it I wasn’t really sure where and why I would need it when I could simply create another component, or a switch case.&lt;/p&gt;

&lt;p&gt;It brings dynamic to your template and you can create reusable components with ease.&lt;/p&gt;

&lt;p&gt;It’s great for performance reasons and simplicity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started with NgTemplateOutlet
&lt;/h2&gt;

&lt;p&gt;What exactly is ngTemplateOutlet?&lt;/p&gt;

&lt;p&gt;It is a structural directive that allows you to render templates dynamically. Pieces of HTML that is used to define the user interface of a component.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fwn5iep2deac7gwanx4e1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fwn5iep2deac7gwanx4e1.png" alt="how to import ngTemplateOutlet" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Of Course in 99% of cases you will import the commonModule itself and not specifically the NgTemplateOutlet, but I wanted to highlight to you where exactly it is.&lt;/p&gt;

&lt;p&gt;First, we define the template - in our case it is &lt;strong&gt;#details&lt;/strong&gt; and I want to point out that this is not the position it will be rendered! We are merely defining it. The position it will be rendered is where the &lt;strong&gt;ng-container&lt;/strong&gt; is located with the correct variable. The template is NOT rendered by default.&lt;/p&gt;

&lt;p&gt;Angular will replace the content in the ng-container with the information we have &lt;strong&gt;inside the template&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Directive
&lt;/h2&gt;

&lt;p&gt;Behind the scenes Angular is creating a new view and setting variables for the template we create. This directive takes an object as its input and Angular creates a new scope for us. It fills the template with the information we provide inside&lt;/p&gt;

&lt;p&gt;Under the hood Angular creates a template and we can reuse it in different conditions.&lt;/p&gt;

&lt;p&gt;What is different with that Directive is that it has its context. We can pass data and work with the template dynamically.&lt;/p&gt;

&lt;p&gt;Let’s give an example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fx5l1uc507lkqz2cbs132.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fx5l1uc507lkqz2cbs132.png" alt="usage of ngTemplateOutlet" width="800" height="514"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see in the example - I define a property called “&lt;strong&gt;user_name&lt;/strong&gt;” inside the ng-template and assign it to “&lt;strong&gt;name&lt;/strong&gt;”. And that name is passed from the “&lt;strong&gt;context&lt;/strong&gt;” in the &lt;strong&gt;ngTemplateOutlet&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I have to admit that the first time I encountered that I was a bit confused, but after a while it all makes sense.&lt;/p&gt;

&lt;h2&gt;
  
  
  Usage of NgTemplateOutlet
&lt;/h2&gt;

&lt;p&gt;As I stated in the title - it is the way I usually use the ngTemplateOutlet. And the most often use case I do use it for is to create and control tables.&lt;/p&gt;

&lt;p&gt;I will explain more on this, but let’s mention another use case - it could be used for rendering dynamic information and to reuse code in the template, if you don’t want to create another component.&lt;/p&gt;

&lt;p&gt;Simple and yet effective. Since you can pass information, you create your mini separate component directly in the template.&lt;br&gt;
Another use case I sometimes find myself is to “separate” logic in the template.&lt;/p&gt;

&lt;p&gt;Let's describe it as a “method” in the HTML template. It’s great since I can provide params into the “function” and it works perfectly.&lt;/p&gt;

&lt;p&gt;It's great to divide logic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In part two I will create a demo repo with examples on the way I use it for tables.&lt;/p&gt;

&lt;p&gt;I have been planning on this for a long time, because I always wanted to create a configurable table I would use on many occasions and on many projects.&lt;/p&gt;

&lt;p&gt;I am going to build it and publish it as a package, in order to reuse it myself.&lt;/p&gt;

&lt;p&gt;There are great and awesome libraries out there, but I always find unique cases that force me to fight the library in order to get something done.&lt;/p&gt;

&lt;p&gt;So in a sense I am gonna build it for myself, but hey, if you find it useful - I am happy!&lt;/p&gt;

&lt;p&gt;Stay tuned, follow and feel free to contact me.&lt;/p&gt;

</description>
      <category>angular</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Using HttpClient, HttpBackend and Observables to consume RESTful APIs</title>
      <dc:creator>Dimitar Stoev</dc:creator>
      <pubDate>Sun, 23 Apr 2023 11:17:09 +0000</pubDate>
      <link>https://forem.com/dimitarstbc/using-httpclient-httpbackend-and-observables-to-consume-restful-apis-29h6</link>
      <guid>https://forem.com/dimitarstbc/using-httpclient-httpbackend-and-observables-to-consume-restful-apis-29h6</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Angular is an incredible framework and I love working with it!&lt;/p&gt;

&lt;p&gt;Playing around and browsing the source code is an incredible learning opportunity. &lt;/p&gt;

&lt;p&gt;One essential feature is the ability to send requests and receive data from the backend server.&lt;/p&gt;

&lt;p&gt;What is an application that doesn’t do that?&lt;/p&gt;

&lt;p&gt;In order to create modern and interactive solutions today with Angular, we need to know the basics of HttpClient and HttpBackend.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is HttpClient
&lt;/h2&gt;

&lt;p&gt;So, what exactly is HttpClient and why do we need it at all? Why not use simple fetch to do the requests?&lt;/p&gt;

&lt;p&gt;It is a built-in Angular service that does some work for us. It makes it easy to send HTTP requests to a server, handle the response and in simpler words - it’s a tool that helps us to communicate with the backend.&lt;/p&gt;

&lt;p&gt;If we open the repository of Angular in GitHub we can see that the file is relatively big and has a bunch of stuff in there.&lt;/p&gt;

&lt;p&gt;With HttpClient we get the following important methods - GET, POST, PUT and DELETE. Let’s check an example to illustrate what is going on.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F125vxfjxocuerw1eslr8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F125vxfjxocuerw1eslr8.png" alt="blob get request" width="800" height="694"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we create an instance of HttpClient we can call the method “get” and pass two arguments - url and an object with some options. Some of them are self explanatory and I am not going to dive too much on them today, but I want to point out something!&lt;/p&gt;

&lt;p&gt;Have a look at the &lt;strong&gt;responseType&lt;/strong&gt;. Here it is defined as ‘blob’ and from that we get a response of Observable that contains a HttpEvent of type Blob.&lt;/p&gt;

&lt;p&gt;Defining it is not required by default, but keep in mind if you are working with specific type of data.&lt;/p&gt;

&lt;p&gt;Let’s look of this example:&lt;/p&gt;

&lt;p&gt;I want to fetch some users and want my response to be of that type. How do I do it?&lt;/p&gt;

&lt;p&gt;I can simply define the type of the request itself.&lt;/p&gt;

&lt;p&gt;Check it out here&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fobdd33zobef85y5tmo2m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fobdd33zobef85y5tmo2m.png" alt="generic request" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the request has been returned, you can subscribe and work with it.&lt;/p&gt;

&lt;p&gt;Important thing I want to share is under the hood Angular uses XHR. The XHR object is a built-in JavaScript object that allows us to send and receive HTTP requests.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why use HttpClient to make requests, when you can use fetch()
&lt;/h3&gt;

&lt;p&gt;Well.. this is open for a debate and some people actually prefer using the fetch(), rather than the HttpClient.&lt;br&gt;
HttpClient handles a lot of details such as setting headers, encoding data and handling the cookies by default. It adds consistency to the codebase.&lt;/p&gt;

&lt;p&gt;Another thing is that Angular is built around the idea of reactive paradigm. And HttpClient is no different. It returns an Observable as we saw in the code earlier.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It also has some built in support for interceptors&lt;/li&gt;
&lt;li&gt;it has some additional methods - such as HEAD, OPTIONS and PATCH&lt;/li&gt;
&lt;li&gt;it supports working with non-JSON data format out of the box&lt;/li&gt;
&lt;li&gt;customizable&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If using fetch() you have to add that abstraction yourself.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is HttpBackend
&lt;/h2&gt;

&lt;p&gt;Most people haven’t used it, some haven’t heard of it.&lt;/p&gt;

&lt;p&gt;If we browse the src folder in the http folder in the official Angular repo we can see a file named “backend.ts”&lt;/p&gt;

&lt;p&gt;What is that?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F7uykfm5fxf6whon3om2n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F7uykfm5fxf6whon3om2n.png" alt="backend ts" width="800" height="694"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we can see it is an abstract class. Simple interface that provides us with the only bare minimum of the HTTP client. No fancy features. No interceptors, no response mapping.&lt;/p&gt;

&lt;p&gt;To use it, you have to create a new instance of HttpClient and pass an instance of HttpBackend.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fq4lgc6bs365qep6e19m2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fq4lgc6bs365qep6e19m2.png" alt="creating backend http" width="800" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It provides a low-level interface for sending HTTP requests and receiving responses and that alone could be useful in some cases where you need more control over the behavior of HTTP requests.&lt;/p&gt;

&lt;p&gt;Some cases could be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;getting the bare minimum and implementing custom HTTP behavior&lt;/li&gt;
&lt;li&gt;improved performance and size, since a lot of the features are just missing&lt;/li&gt;
&lt;li&gt;very specific custom and complex request&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That leads to manually handling eros and parsing your responses.&lt;/p&gt;

&lt;p&gt;I have seen this implementation myself only once and most of the time you will know you need it.&lt;/p&gt;

&lt;p&gt;In like 99% of cases.. you probably don’t.&lt;/p&gt;

&lt;p&gt;I am interested - have you implemented it and in what conditions?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important note - when using the HttpBackend you must know that it bypass as of its nature the interceptor chain&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This could be useful if you need to create requests that you don’t want to go through the interceptors.&lt;/p&gt;

&lt;p&gt;You won’t need to create some fancy solutions and handle conditionals logic.&lt;/p&gt;

&lt;p&gt;Just create a service and do the requests you need through it!&lt;/p&gt;

&lt;h2&gt;
  
  
  The Holy Observable
&lt;/h2&gt;

&lt;p&gt;Observables play an incredibly important role in working with HttpClient and HttpBackend in Angular.&lt;/p&gt;

&lt;p&gt;As we saw, the request returns Observable of specific type.&lt;/p&gt;

&lt;p&gt;I have written a little article on how I usually work with Observables and I am planning to go a lot deeper in the future and create some cheat sheets for all of us to use.&lt;/p&gt;

&lt;p&gt;If that is something of your interest.. a follow would be nice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;So much to learn and so many different implementations and ideas.&lt;/p&gt;

&lt;p&gt;Incredible framework with incredible power.&lt;/p&gt;

&lt;p&gt;I absolutely love working with it and am eager to learn all the time.&lt;/p&gt;

&lt;p&gt;HttpClient and HttpBackend are incredible tools that allow us to make complex and interactive applications.&lt;/p&gt;

&lt;p&gt;All the features we get from HttpClient do a lot of the heavy work for us and implementing it is as easy as possible.&lt;/p&gt;

&lt;p&gt;Thank you for your time and don’t forget to follow me for more!&lt;/p&gt;

</description>
      <category>angular</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How I work with Observables in Angular</title>
      <dc:creator>Dimitar Stoev</dc:creator>
      <pubDate>Sat, 15 Apr 2023 13:15:31 +0000</pubDate>
      <link>https://forem.com/dimitarstbc/how-i-work-with-observables-in-angular-49hl</link>
      <guid>https://forem.com/dimitarstbc/how-i-work-with-observables-in-angular-49hl</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This is a subject that is intimidating for a lot of folks out there and I have heard people explain it’s just too hard. In the beginning when I first started learning Angular I was having the same feelings. Like… What the hell? Why do I even need this Observable thing?&lt;/p&gt;

&lt;p&gt;I managed to love it now and I prefer to always go reactive and always consider using RxJS as my goto approach first.&lt;/p&gt;

&lt;p&gt;But with great powers, you know the rest.&lt;/p&gt;

&lt;p&gt;There are many ways to deal with a single problem and this approach is my preferable one.&lt;/p&gt;

&lt;p&gt;In the next lines I am going to talk about how I like to work with Observables and how I prefer to handle data.&lt;/p&gt;

&lt;p&gt;This is part of my Angular series and it would be great if you subscribe / follow. It shows me that these articles are actually helpful to someone.&lt;/p&gt;

&lt;h3&gt;
  
  
  What to expect?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Observables and declaring them&lt;/li&gt;
&lt;li&gt;Subscribing to them with Async pipe&lt;/li&gt;
&lt;li&gt;Working on data with Pipes&lt;/li&gt;
&lt;li&gt;Combining pipes in the HTML template&lt;/li&gt;
&lt;li&gt;Working demo showing all of the above&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What are Observables?
&lt;/h2&gt;

&lt;p&gt;An observable. Simply put - a producer of data, a pipe that is delivering information on a consumer. It produces the value and delivers it when asked to.&lt;/p&gt;

&lt;p&gt;There are certain types of Observables. We have cold ones and hot ones. Streaming data when asked and streaming data regardless of potential subscribers respectfully.&lt;/p&gt;

&lt;p&gt;The observable itself plays a very central part of the reactive programming that is used in the framework. It is used often to manage asynchronous data, HTTP requests for example, inputs, and custom logic.&lt;/p&gt;

&lt;p&gt;The “Observable” interface that the class implements, defines a set of methods and properties that allow us to interact with the observable, subscribe to the emissions and handle any errors. It includes a completion event as well.&lt;/p&gt;

&lt;p&gt;When we subscribe to an observable, it creates a new subscription object. This object is used to control and manage the interaction between the observable and the subscriber.&lt;/p&gt;

&lt;p&gt;It is important to point out that unsubscribing is an important part of the working flow of working with Observables. Especially if we are talking about hot observables that are sending data regarding the user interaction.&lt;/p&gt;

&lt;p&gt;The “async” pipe is doing this for now and it is my preferred way to deal with Observables.&lt;/p&gt;

&lt;p&gt;Another thing that RxJS is providing us with is the ability to manipulate the data before passing it to the consumer. We have various operators to choose from that have different behaviors.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using Async pipe
&lt;/h3&gt;

&lt;p&gt;When it comes to my personal preferences I usually prefer to define the Observable in my class and use the async pipe in the template.&lt;br&gt;
This is great, since it automatically does subscribing and unsubscribing to it. Getting the data is easy and handling it is easy as well.&lt;/p&gt;

&lt;p&gt;Let’s get to the examples. We have a list of users and we want to iterate over it. Our task is to list the information to our user.&lt;br&gt;
You can check the entire source code in the repo, but I am going to provide snippets here.&lt;/p&gt;

&lt;p&gt;I usually create the services, the interfaces and then declare the observable with the correct type in the .ts file. Subscribing is done with the async pipe.&lt;br&gt;
In this example I am getting the entire list of users.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F57p0cturq9zilma9uyqm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F57p0cturq9zilma9uyqm.png" alt="observable declaration" width="800" height="327"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fhik8lca1edflumnjk9yj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fhik8lca1edflumnjk9yj.png" alt="observable template" width="800" height="266"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Angular is using the pipe and subscribes to this observable under the hood. The data is loaded and when delivered - rendered.&lt;/p&gt;

&lt;p&gt;We are going to implement routing and loading single data usage. RxJS is going to help us here.&lt;/p&gt;

&lt;h3&gt;
  
  
  Loading single user
&lt;/h3&gt;

&lt;p&gt;The moment a user is clicked in the &lt;strong&gt;list&lt;/strong&gt; we are using &lt;strong&gt;routerLink&lt;/strong&gt; to change the route and load the data of the specific user. We will load status and description. Nothing more for our little demo, but I am going to highlight my approach on controlling the data there.&lt;/p&gt;

&lt;p&gt;I am using &lt;strong&gt;from&lt;/strong&gt; operator here to convert my &lt;strong&gt;USERS&lt;/strong&gt; array to an observable stream and ‘find’ to return either the found user or an error using the &lt;strong&gt;throwError&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F7wsu6muvl92x3hslr2r8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F7wsu6muvl92x3hslr2r8.png" alt="observable single user" width="800" height="470"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Many ways to handle the id of the route, but I am going to use something simple for this. I want to showcase the template and the combination with the *ngIf directive.&lt;/p&gt;

&lt;p&gt;I am still using the onPush change detection and the user is an observable of User type. The control of the data is reactive.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fndf1eo23nmfss2kzz4rb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fndf1eo23nmfss2kzz4rb.png" alt="single user template" width="800" height="757"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s say I want to list the active users. We have a property that sets their “status”. I would go with the following - since I already have the users, I could just pipe them again and filter it there.&lt;/p&gt;

&lt;p&gt;Fast and clean!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fjluhbn4wf8p6kcro336r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fjluhbn4wf8p6kcro336r.png" alt="filter users" width="800" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the provided repo below, you can check a functionality that adds users, update the UI automatically on update using BehaviorSubject and Observable.&lt;/p&gt;

&lt;p&gt;The template is rendered with an async pipe as well.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fulwalg0pj3m04msuknhr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fulwalg0pj3m04msuknhr.png" alt="filter users template" width="800" height="286"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to use Observables and Pipes together in Angular?
&lt;/h2&gt;

&lt;p&gt;I love pipes. I try to use them as much as possible. I know not every time is the best time to use them and sometimes it’s just not the case.&lt;/p&gt;

&lt;p&gt;But let’s say you have a response and get that users. But you need to arrange the data in specific order.&lt;/p&gt;

&lt;p&gt;What do you do?&lt;br&gt;
I could do the job perfectly with a custom Pipe here. I get Users[] and return Users[].&lt;/p&gt;

&lt;p&gt;Let’s see an example.&lt;/p&gt;

&lt;p&gt;I am reworking the template in order to handle null users. Chaining pipes is just too great!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fmud7x5bbx27v8h03vjp1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fmud7x5bbx27v8h03vjp1.png" alt="observable with pipe" width="800" height="286"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One thing I usually do as well is combine all these Observables into one. I am using combineLatest in this example to use it as a single variable in the template.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fnja2pm7z34x2jfnvhydg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fnja2pm7z34x2jfnvhydg.png" alt="combine latest" width="800" height="470"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The template:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fejhqpn479x1s677vinnp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fejhqpn479x1s677vinnp.png" alt="combine latest template" width="800" height="490"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo project
&lt;/h2&gt;

&lt;p&gt;The entire source code is in a repo on my GitHub profile. Every example here is there and you can check the interactions and the way it is structured.&lt;/p&gt;

&lt;p&gt;Here is the link&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/dimitar-stoev/observables-example" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I am planning to expand this into a bigger demonstration project with design, functionality and some patterns and practices, so if you are interested in that - follow and “star” the project.&lt;/p&gt;

&lt;p&gt;Thank you in advance!&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I really love working with Observables, Subjects, BehaviourSubjects and pipes. When I start a feature, I always try to plan in advance and I try to plan as reactively and declaratively as possible.&lt;/p&gt;

&lt;p&gt;In the project I listed above, I am planning to create a full application with best practices and every article I write for Angular is going to be referred to and implemented in the project ( whenever is possible of course ).&lt;/p&gt;

&lt;p&gt;Thank you and good luck!&lt;/p&gt;

</description>
      <category>angular</category>
      <category>webdev</category>
    </item>
    <item>
      <title>My Personal Takes on How to Pass a Tech Interview</title>
      <dc:creator>Dimitar Stoev</dc:creator>
      <pubDate>Sun, 02 Apr 2023 10:14:20 +0000</pubDate>
      <link>https://forem.com/dimitarstbc/my-personal-takes-on-how-to-pass-a-tech-interview-1h93</link>
      <guid>https://forem.com/dimitarstbc/my-personal-takes-on-how-to-pass-a-tech-interview-1h93</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;I know it’s scary to a lot of people, but knowing how to pass an interview is a skill on its own. While technical skills and experience are certainly important, there are many other factors that can influence a hiring decision. &lt;/p&gt;

&lt;p&gt;Soft skills can make a significant difference in how well you can perform in a tech interview and can lead to a better result. Communication, attitude and personality could be crucial.&lt;/p&gt;

&lt;p&gt;By the end of the post, you will have a better understanding of how to approach a tech interview and increase your chances of success. This strategy works both for junior developers and more advanced ones.&lt;/p&gt;

&lt;h2&gt;
  
  
  To whom do I write this article?
&lt;/h2&gt;

&lt;p&gt;I want to make one thing clear before I continue with the article. This article IS NOT for someone who is just trying to get into tech for money or for someone who just wants to “cheat” the system.&lt;/p&gt;

&lt;p&gt;This article is for people who are passionate about their work and love what they do, but have some problems managing their interviews. &lt;/p&gt;

&lt;p&gt;This article is for people who don’t just want to be programmers, but want to get further ahead. &lt;/p&gt;

&lt;p&gt;These tips could be used not only for passing an interview, but also to expand your knowledge and improve yourself.&lt;/p&gt;

&lt;p&gt;Ok, so let’s get it all started.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why do soft skills matter?
&lt;/h2&gt;

&lt;p&gt;If you try to compare yourself to other programmers, you will usually find several other people that are WAY smarter and better than you. And that’s absolutely fine! To be in the 1% of top programmers is something that most of us probably don’t even want. &lt;/p&gt;

&lt;p&gt;When you apply for a job, you can’t just expect and hope that someone will notice your CV. At some companies, most CVs don't even get to HR. There is an algorithm that makes the initial decisions. If you pass that phase, there is a good chance your CV is going to be compared to the best candidates for the job.&lt;/p&gt;

&lt;p&gt;How would I fight that? Are you going to leave it all to chance?&lt;/p&gt;

&lt;p&gt;You know soft skills are important, but how to show them if you are not even picked for an interview?&lt;/p&gt;

&lt;h3&gt;
  
  
  Be prepared and organized
&lt;/h3&gt;

&lt;p&gt;Let’s start with the more trivial information. Research the companies you are applying to. &lt;/p&gt;

&lt;p&gt;I have always been against the idea of mass spam and apply to every single job out there. If you are looking for specific positions, try to search for the right position, not just every open one.&lt;/p&gt;

&lt;p&gt;There are way too many companies out there and you need to take your time to find the right one. Pick just a few. Below ten is perfect in my opinion. &lt;/p&gt;

&lt;p&gt;When you do that, check everything possible about them, find the people who take the decisions on social media, learn what they think about topics that are interesting to you and so on.&lt;/p&gt;

&lt;p&gt;Try to feel the culture.&lt;/p&gt;

&lt;p&gt;Engage!&lt;/p&gt;

&lt;p&gt;Engage with them, talk to them and prepare a cover letter individually for every single company. Don’t copy and paste. Be serious about it!&lt;/p&gt;

&lt;p&gt;You are not spamming companies, you are looking for the best place possible for you. You want to be happy at that company and working with like minded people. That's how you are going to be productive and you will enjoy working.&lt;/p&gt;

&lt;h3&gt;
  
  
  Communicate clearly and confidently
&lt;/h3&gt;

&lt;p&gt;This is a hard one, since it takes the most time. It’s not something that you can change in a day, but it is something that will improve every area of your life. &lt;/p&gt;

&lt;p&gt;When you engage with people on social media or recruiters, you need to show that you are a professional and bring real value. People have to know you are capable of taking decisions and sticking by them. &lt;/p&gt;

&lt;p&gt;Show that you have an opinion on topics, even if they are controversial. I would avoid politics tho.. &lt;/p&gt;

&lt;p&gt;If you engage with the right people and when you start to promote yourself, they would already know you. That’s something other candidates won’t have. &lt;/p&gt;

&lt;p&gt;It’s always better to hire a professional you know, than to expect to find a good match out of the blue.&lt;/p&gt;

&lt;h3&gt;
  
  
  Showcase your knowledge
&lt;/h3&gt;

&lt;p&gt;Okay, I will lose some readers, but writing is the best way to get a job. And not only tech jobs, but any job.&lt;/p&gt;

&lt;p&gt;I am new to writing and I even get some offers out of thin air because of it. I occasionally write articles about Angular and people expect me to know Angular, even before talking to me at all. That’s a power out there!&lt;/p&gt;

&lt;p&gt;It doesn’t matter the field you are in. It’s not just tech. It has applications in a variety of fields. If you know something - share it. You accomplish two important things that way:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You show your domain and when people engage with you, you don’t need to prove anything. They already know you know.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You are shifting the interview and the conversation from “Does this guy know about it?” to “Okay, he is a professional, let’s see if the personality can match the culture”&lt;/p&gt;

&lt;p&gt;The hardest part is already behind you!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You help people that start today!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I believe this is also important. You face challenges that a lot of other people are facing as well. Help as many people as you can.&lt;/p&gt;

&lt;p&gt;The fulfillment is great!&lt;/p&gt;

&lt;p&gt;Let’s summarize. Demonstrating the softs skills you have before applying even for the job is bringing you so much value, it’s unbelievable. Too many people are not playing the bigger game and if you start now - you are way ahead already!&lt;/p&gt;

&lt;h2&gt;
  
  
  Demonstrate your technical skills
&lt;/h2&gt;

&lt;p&gt;This is where most of the stuff can go very wrong! Getting here is not a small task and I can argue for a long time that soft skills are important as much as technical ones. But a lot of people assume that the technical part of the interview is .. well.. only technical. &lt;/p&gt;

&lt;p&gt;This part of the interview needs the best of your soft skills!&lt;/p&gt;

&lt;p&gt;Let’s take two examples&lt;/p&gt;

&lt;h3&gt;
  
  
  Example one: The experience
&lt;/h3&gt;

&lt;p&gt;We have this guy who has a ton of experience. Almost ten years, working as a back end engineer. He usually gets the job done fine, nothing fancy, nothing great. He is developing his technical abilities, but doesn’t give a dime for his social and soft skills.&lt;/p&gt;

&lt;p&gt;Working like that leads to bad companies and people don’t like to work with him too much. He is not very sharing either. &lt;/p&gt;

&lt;p&gt;When he goes to interviews, he smashes the technical one, but he ends up all the time at bad companies. That leads him to being average and he starts to show signs of “not caring” enough. Why is that?&lt;/p&gt;

&lt;p&gt;I believe it’s an easy answer. Soft skills are skills that could be learned and it’s not just “that’s the way I am, take it or leave it”. Well.. most people won’t take it.&lt;/p&gt;

&lt;p&gt;Don’t just assume you got the job, only because you know a lot. Many people do. It’s not enough even in this demanding market. Great companies want great people.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example two: The great character
&lt;/h3&gt;

&lt;p&gt;A person with around three years of experience, but with great soft skills. He always tries to teach somebody, and share knowledge all the way. Demand from himself. &lt;/p&gt;

&lt;p&gt;He always expects more from himself and this leads to better communication. He is not writing articles, but he is always talking to people. He is engaging in network events and even led some small conferences in his hometown.&lt;/p&gt;

&lt;p&gt;He is the guy that works around half the day and the other half is helping people. Great personality.&lt;/p&gt;

&lt;p&gt;Who do you think is more respected and has the better job?&lt;/p&gt;

&lt;p&gt;Easy answer, I know.&lt;/p&gt;

&lt;h3&gt;
  
  
  The interview
&lt;/h3&gt;

&lt;p&gt;When you get to that part, show your passion for the technology. You have written articles, you have talked to people, you have managed to understand the language.&lt;/p&gt;

&lt;p&gt;Show that!&lt;/p&gt;

&lt;p&gt;Don’t just answer questions. When they ask you about something, expand it, talk with understanding.&lt;/p&gt;

&lt;p&gt;And question back!&lt;/p&gt;

&lt;p&gt;Ask questions about how they use the technology they ask you about. Ask questions about implementation and architecture in the project they have. Show the interest you have gained while developing the company beforehand. &lt;/p&gt;

&lt;p&gt;Try to understand where you are going before even opening and cloning the repository. Act as you are part of the team already.&lt;/p&gt;

&lt;p&gt;Those interviewers are real people who have the same passion ( most of the time ) as you. Engage in conversation and not just Q&amp;amp;A.&lt;/p&gt;

&lt;p&gt;When they ask you what you would do in a particular situation, ask them back. They have that question for a reason. Learn how they did it and why. Be curious. &lt;/p&gt;

&lt;p&gt;Your attitude should change from “he is above me and I have to prove myself worth it” to “We are both technology lovers and I want to make sure I am getting in the right company”.&lt;/p&gt;

&lt;p&gt;No better way to do that than to ask the right questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional tips
&lt;/h2&gt;

&lt;p&gt;Some of this will cost money, but the harsh reality is that no matter what some fake gurus are telling you. You can’t make it all for free.&lt;/p&gt;

&lt;p&gt;Let’s make it in a bullet points&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;website - make it your own and share to other platforms&lt;/li&gt;
&lt;li&gt;professional email - don’t use your Gmail account. It’s not serious.&lt;/li&gt;
&lt;li&gt;github account - take some time to make it look good&lt;/li&gt;
&lt;li&gt;professional image for your social media accounts - use one for all&lt;/li&gt;
&lt;li&gt;share and network offline as well - a lot of good offers come by by people you know in real life&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Follow up after the interview. Don’t forget to follow up if time passes by.&lt;/p&gt;

&lt;p&gt;You need to know what happened and feedback is important to you. Be serious about it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summarizer
&lt;/h2&gt;

&lt;p&gt;Passing an interview it's a skill. You will manage after passing a few with no problem. You can learn the asked questions and pass every single one of them.&lt;/p&gt;

&lt;p&gt;But doing that is a game of chance and luck. I don’t believe in that way of doing “life”. You need to take control of your own life and career.&lt;/p&gt;

&lt;p&gt;Advance your soft skills, advance your writing skills and talk to people A LOT. Engage as much as possible. Show yourself to the world.&lt;/p&gt;

&lt;p&gt;Be the picker. You choose the companies that you work for. Not chance.&lt;/p&gt;

&lt;p&gt;It takes a lot of time, but it’s worth it. &lt;/p&gt;

&lt;p&gt;Good luck!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>tips</category>
    </item>
    <item>
      <title>What is CommonModule in Angular</title>
      <dc:creator>Dimitar Stoev</dc:creator>
      <pubDate>Sun, 26 Mar 2023 10:41:12 +0000</pubDate>
      <link>https://forem.com/dimitarstbc/what-is-commonmodule-in-angular-5am0</link>
      <guid>https://forem.com/dimitarstbc/what-is-commonmodule-in-angular-5am0</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hey there and thanks for stepping by!&lt;/p&gt;

&lt;p&gt;So what is CommonModule? You have seen it, you know it delivered the *ngIf, *ngFor and so on, but what else do we have?&lt;/p&gt;

&lt;p&gt;In the docs it says it’s reexported again with BrowserModule.. but why?&lt;/p&gt;

&lt;h2&gt;
  
  
  What is CommonModule in Angular
&lt;/h2&gt;

&lt;p&gt;To understand what exactly is CommonModule we should first make it clear what exactly is a module and what it does for us.&lt;/p&gt;

&lt;p&gt;In Angular we say we create &lt;strong&gt;modular applications&lt;/strong&gt; because we &lt;strong&gt;scope and group&lt;/strong&gt; together different entities. Through modules we &lt;strong&gt;declare and provide&lt;/strong&gt; those same entities.&lt;/p&gt;

&lt;p&gt;While our application grows it requires more features and more segregation. Defining every feature in a separate logical block is a good practice we should all follow.&lt;/p&gt;

&lt;p&gt;To use components and directives from that module we need to provide its existence to Angular. That means to import it in other modules that require those components.&lt;/p&gt;

&lt;p&gt;So to summarize and explain, the CommonModule is an Angular module that contains and exports Angular components, directives and pipes.&lt;/p&gt;

&lt;p&gt;Checking app.module.ts is enough to understand why reexporting it in BrowserModule is enough to have access to CommonModule components in the app module.&lt;/p&gt;

&lt;p&gt;I am not going to dive into the BrowserModule today, but keep in mind that BrowserModule must be imported only once, since it provides services that are essential to launch and run a browser application. And you don’t need that for your feature modules.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do you need CommonModule if you don’t need CommonModule?
&lt;/h3&gt;

&lt;p&gt;When you create a new module by using the Angular CLI, it automatically adds CommonModule to the imports. But since we already know that it is just for exporting basic utilities, you can safely delete it and everything should work just fine.&lt;/p&gt;

&lt;p&gt;So.. Do you delete it if you are not going to use anything from it? Well, I always leave it there, but I will leave that decision up to you.&lt;/p&gt;

&lt;p&gt;The CommonModule is acting as every other module out there.&lt;/p&gt;

&lt;p&gt;If you have a &lt;strong&gt;SharedModule&lt;/strong&gt;, you can import and export your &lt;strong&gt;CommonModule&lt;/strong&gt; there and importing the SharedModule is going to be sufficient to have access to all CommonModule components, directives and pipes.&lt;/p&gt;

&lt;p&gt;It could be useful, if you are planning to optimize your imports.&lt;/p&gt;

&lt;h2&gt;
  
  
  Inside the CommonModule
&lt;/h2&gt;

&lt;p&gt;I believe that to have a good understanding, you have to check the source, rather than the docs.&lt;/p&gt;

&lt;p&gt;The documentation is great for first look and getting started, but to understand the technology behind, you have to check the github repo.&lt;/p&gt;

&lt;p&gt;Let’s check the directive first. If we go to the common package in the official Angular repo, we can see an index file that exports all Angular directives.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fzrtyogfam1rdcrkscihh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fzrtyogfam1rdcrkscihh.png" alt="directive inside CommonModule" width="800" height="712"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;NgClass - add or remove CSS classes from an HTML element based on a boolean expression&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;NgComponentOutlet - dynamically render a component based on a provided component type&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;NgFor - loop through an array or iterable and render a template for each item&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;NgForOf - a variation of NgFor&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;NgForOfContext - a class that represents the context in which NgForOf is rendered and it provides properties and methods for accessing information about the current item being rendered&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;NgIf - conditionally renders HTML elements based on a boolean expression&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;NgIfContext - a class that represents the context in which - NgIf is rendered and it provides properties and methods for accessing information about the current state of the directive&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;NgPlural - conditionally render HTML elements based on a numeric value and provides support for multiple plural forms&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;NgPluralCase - used inside of NgPlural to define a template for a specific plural case, such as “one”, “few”, or “many”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;NgStyle - add or remove CSS styles from an HTML element based on a boolean expression&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;NgSwitch - conditionally renders HTML elements based on a provided value, and it supports multiple cases&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;NgSwitchCase - used inside of NgSwitch to define a template for a specific case value&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;NgSwitchDefault - used inside of NgSwitch to define a template that is rendered when none of the cases match the provided value&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;NgTemplateOutlet - render a template dynamically by specifying the template reference to be rendered&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s do the same for the pipes&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Firzk32xcyzczh105bslo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Firzk32xcyzczh105bslo.png" alt="pipes inside CommonModule" width="800" height="835"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AsyncPipe - subscribe to an Observable or Promise and render the emitted or resolved value in the template&lt;/li&gt;
&lt;li&gt;CurrencyPipe - format a numeric value as currency according to a specified currency code and format&lt;/li&gt;
&lt;li&gt;DATE_PIPE_DEFAULT_OPTIONS - constant that defines the default options for the DatePipe, such as the format and locale&lt;/li&gt;
&lt;li&gt;DATE_PIPE_DEFAULT_TIMEZONE - constant that defines the default timezone for the DatePipe&lt;/li&gt;
&lt;li&gt;DatePipe - format a date value according to a specified format and timezone&lt;/li&gt;
&lt;li&gt;DatePipeConfig - interface that defines the configuration options for the DatePipe, such as the format and timezone&lt;/li&gt;
&lt;li&gt;DecimalPipe - format a numeric value as a decimal according to a specified format&lt;/li&gt;
&lt;li&gt;I18nPluralPipe - allows you to internationalize the pluralization of text based on a numeric value and a set of pluralization rules for different locales&lt;/li&gt;
&lt;li&gt;I18nSelectPipe - allows you to internationalize text based on a given value and a set of translations for different locales&lt;/li&gt;
&lt;li&gt;JsonPipe - transform a JavaScript object into a JSON string&lt;/li&gt;
&lt;li&gt;KeyValue - iterate over the properties of an object and render a template for each key-value pair&lt;/li&gt;
&lt;li&gt;KeyValuePipe - transform an object into an array of key-value pairs, which can be used with other pipes or directives&lt;/li&gt;
&lt;li&gt;LowerCasePipe - transform a string into lowercase&lt;/li&gt;
&lt;li&gt;PercentPipe - format a numeric value as a percentage according to a specified format&lt;/li&gt;
&lt;li&gt;SlicePipe - slice an array or a string and return a portion of it based on a start and end index&lt;/li&gt;
&lt;li&gt;TitleCasePipe - transform a string into title case, which means that the first letter of each word is capitalized&lt;/li&gt;
&lt;li&gt;UpperCasePipe - transform a string into uppercase&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The CommonModule is an essential module in Angular that provides us with powerful tools that allows us to save time and effort in implementing common functionality and improve the consistency and maintainability of the code.&lt;/p&gt;

&lt;p&gt;You can further expand and increase the utility of the CommonModule by adding more features to it. Since it's just a module, you import and re-export it again with extended functionality.&lt;/p&gt;

&lt;p&gt;The Angular team is providing us with directives and pipes that are very crucial for building scalable and maintainable applications.&lt;/p&gt;

</description>
      <category>angular</category>
    </item>
    <item>
      <title>Using forRoot() and forChild() in Angular</title>
      <dc:creator>Dimitar Stoev</dc:creator>
      <pubDate>Sun, 19 Mar 2023 11:19:10 +0000</pubDate>
      <link>https://forem.com/dimitarstbc/using-forroot-and-forchild-in-angular-16da</link>
      <guid>https://forem.com/dimitarstbc/using-forroot-and-forchild-in-angular-16da</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hey there, Angular enthusiasts and new learners! I want to dive a little bit today in some Angular patterns and methods that you probably have already seen.&lt;/p&gt;

&lt;p&gt;I am going to talk about managing dependencies and configuration information.&lt;/p&gt;

&lt;p&gt;A pattern for singleton services that allows us to have control over the providers through the application cycle and modules.&lt;/p&gt;

&lt;p&gt;I am talking about forRoot and forChild.&lt;/p&gt;

&lt;p&gt;Sit back, relax and let’s explore and dive a little bit into these powerful methods.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is &lt;strong&gt;forRoot&lt;/strong&gt; in Angular and why do we need it?
&lt;/h2&gt;

&lt;p&gt;When we create a service with Angular version above 6, Angular creates an object in our @Injectable  with a property &lt;strong&gt;provideIn: ‘root’&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fkjf8fzg4578ade80hqv2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fkjf8fzg4578ade80hqv2.png" alt="provide in root" width="800" height="324"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Of Course we are perfectly free to change the ‘root’ with any module we want. This means UserService won’t be available unless we import the Module we specify in the &lt;strong&gt;“provideIn”&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I can be more generic and say that forRoot is used to provide configuration data that's needed to initialize a module and its components. This configuration data can be anything from environment variables to API keys, and it's used to set up the application in a specific way.&lt;/p&gt;

&lt;p&gt;The biggest use case most developers talk about is the static method forRoot in RouterModule. This is the method that configures the entire routing module for your application and Angular creates it globally.&lt;/p&gt;

&lt;p&gt;The method itself returns ngModule with optional providers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ftvsc829sfaz6utqwtvhj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ftvsc829sfaz6utqwtvhj.png" alt="router module with providers" width="800" height="262"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some time ago I wrote an article about how I structure my Angular application. I will use that to give you examples on RouterModule forRoot and forChild methods.&lt;/p&gt;

&lt;p&gt;You can read the article here or on my website:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.stoev.dev/blog/how-i-structure-my-angular-applications" rel="noopener noreferrer"&gt;https://www.stoev.dev/blog/how-i-structure-my-angular-applications&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F00nn2wgmsd5s7zfw8n2q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F00nn2wgmsd5s7zfw8n2q.png" alt="app routing module" width="800" height="835"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see here in the imports I call this forRoot method and pass as arguments the routes I have defined earlier. This method is static and Angular is requiring some arguments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;static forRoot(routes: Routes, config?: ExtraOptions): ModuleWithProviders&amp;lt;RouterModule&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When Angular is creating the application it is creating the routing system and it is available through the existence of the application.&lt;/p&gt;

&lt;p&gt;Typically forRoot is used only once in an application and it’s always called in the root module.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create your own forRoot()
&lt;/h3&gt;

&lt;p&gt;It is by convention, but you can use any name you want. You are perfectly free to create your own forRoot method and put it in your module. After all, a module is a class.&lt;/p&gt;

&lt;p&gt;Here it is an example on how to provide an instance of a core module and be sure that it is only called once!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ffhh2ykc214k6llhveorh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ffhh2ykc214k6llhveorh.png" alt="core module singleton" width="800" height="794"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As I said, &lt;strong&gt;this method could be called anything&lt;/strong&gt;, but I am calling &lt;strong&gt;forRoot()&lt;/strong&gt; because of a convention. It can take arguments as well.&lt;/p&gt;

&lt;p&gt;For example I can pass initial configuration data to the module and therefore its components.&lt;/p&gt;

&lt;p&gt;Let’s do just that.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fapiregq9eipacvkjlqdv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fapiregq9eipacvkjlqdv.png" alt="routing config" width="800" height="1224"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is forChild in Angular
&lt;/h2&gt;

&lt;p&gt;forChild is very similar to forRoot.&lt;/p&gt;

&lt;p&gt;Following the router example it is important to point out that this static method is loaded in the feature modules usually that are being loaded into the root module. It allows us to configure the feature modules without affecting the entire application.&lt;/p&gt;

&lt;p&gt;Let’s point out that lazy modules create new instances of the services and providers when the module itself is loaded. This is because Angular uses another Injector to create the modules. A separate one.&lt;/p&gt;

&lt;p&gt;In the case of the RoutingModule forChild() is not creating the routing service. It is a necessary method when we have multiple routing modules.&lt;/p&gt;

&lt;p&gt;Let’s see an example. This is the lazy module we have implemented previously.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fq0qr9hsfjvd1jrnt06f7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fq0qr9hsfjvd1jrnt06f7.png" alt="routing module child" width="800" height="651"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can create a similar method for yourself in the class and when you can pass only the feature specific services and providers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Differences between forRoot and forChild
&lt;/h2&gt;

&lt;p&gt;Okay, let’s discuss and examine some of the differences. I am going to concentrate on the RouterModule here, since that is mostly used and it could be useful also for understanding how it works. Let’s point out first what the similarities are.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Declares the router information&lt;/li&gt;
&lt;li&gt;Manages the routes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One difference is that forRoot is typically used for the entire application while forChild is used in feature modules.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Another key difference is that forRoot registers the router services, while forChild does not!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It could be said also that they have different scope, frequency of use and access to services and providers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, forRoot() and forChild() are powerful methods in Angular that are used to configure modules and their components. While both methods are similar in their purpose, they have key differences that make them unique and valuable in different contexts.&lt;/p&gt;

&lt;p&gt;By using forRoot and forChild effectively, you can ensure that your Angular application is properly configured and ready to handle all of its requirements.&lt;/p&gt;

&lt;h3&gt;
  
  
  Dont’s miss a beat
&lt;/h3&gt;

&lt;p&gt;I hope you found this post on forRoot and forChild in Angular helpful! If you want to stay up to date on the latest tips and tricks for Angular development, be sure to subscribe to my blog and follow me on social media.&lt;/p&gt;

</description>
      <category>angular</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to grow your career as a web developer in 2023</title>
      <dc:creator>Dimitar Stoev</dc:creator>
      <pubDate>Mon, 13 Mar 2023 14:02:36 +0000</pubDate>
      <link>https://forem.com/dimitarstbc/how-to-grow-your-career-as-a-web-developer-in-2023-4312</link>
      <guid>https://forem.com/dimitarstbc/how-to-grow-your-career-as-a-web-developer-in-2023-4312</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Are you a web developer looking to take your career to the next level? Whether you're just starting out or you've been in the field for a while, there are always new opportunities to learn and grow.&lt;br&gt;
In today's rapidly evolving digital landscape, web development is a constantly evolving field. As technology continues to advance, there is an increasing demand for skilled developers who can create innovative and responsive websites and applications.&lt;/p&gt;

&lt;p&gt;To stay competitive in this field, it's essential to keep up with the latest trends and technologies and continually refine your skills. In this article, we'll explore some practical strategies for growing your career as a web developer, from honing your technical skills to building a strong professional network.&lt;/p&gt;

&lt;p&gt;Whether you're looking to advance in your current position, explore new job opportunities, or strike out on your own as a freelancer or entrepreneur, the tips and advice in this article can help you achieve your goals and succeed in the dynamic and exciting world of web development. So, let's get started with the Takeaways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Avoid generic and overused advice. Instead, focus on actionable strategies that are specific to your goals and career aspirations&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Soft skills are just as important as technical skills in web development. Communication, collaboration, and problem-solving are essential for success in this field&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Don't rely on someone else to teach you everything. Take ownership of your own learning and seek out resources and opportunities to grow your skills and knowledge&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Write for yourself or the community. Creating content can help you establish yourself as an expert in your field and build a strong online presence&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Consider mentoring someone else as soon as possible. Not only does it help someone else learn and grow, but it can also help you develop leadership and communication skills&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Overcome the impostor syndrome. Many web developers experience feelings of self-doubt and insecurity, but it's important to recognize your own strengths and accomplishments and embrace a growth mindset&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now let’s dive deeper and explain myself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Avoid generic and overused advice
&lt;/h2&gt;

&lt;p&gt;Are you tired of reading generic articles and blog posts that offer little new information? Why do I believe there are too many generic articles and blog posts? It seems like everyone is writing for the Google algorithm these days, resulting in repetitive advice that doesn't truly help you grow as a web developer. For example - create your own website, solve problems on websites like hackerrank and leetcode, work with people that are smarter than you and so on. You get the point. This is just the tip of the iceberg.&lt;/p&gt;

&lt;p&gt;This is absolutely great and will definitely make you better. But to get on the next side of the river… well.. it’s not enough. It will make you above average and if you are just starting out - it will probably increase your chances by a factor of.. a lot.&lt;/p&gt;

&lt;p&gt;But I have managed to obtain some information from people around me who are way above average and also have examined people in the field. I even have a number in percentage that I calculated from my own experience. I will share it later in the article.&lt;/p&gt;

&lt;p&gt;I will also give you a few bad examples on why you need to push it further.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Soft skills
&lt;/h2&gt;

&lt;p&gt;Reliability, owning your words and problems and strong character. Read that again and let’s start explaining.&lt;/p&gt;

&lt;p&gt;Software development is working with people for people. We stay in front of the machine and execute command after command but let’s not forget that we are mostly working as teams and clients. There are three main characteristics in my opinion that go beyond all others.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reliability
&lt;/h3&gt;

&lt;p&gt;People need to know that they can count on you. If you show yourself and stay to your word, you will grow not even in software.&lt;/p&gt;

&lt;p&gt;In the Internet technology world, if people can rely on you it means you are going to grow as a leader. Growing as a leader means you will be part of bigger and more important decisions.&lt;/p&gt;

&lt;p&gt;Managers will feel more comfortable with a less knowledgeable, but reliable person, thank someone who knows his domain, but has character problems.&lt;/p&gt;

&lt;p&gt;Stay to your words! That lead us to:&lt;/p&gt;

&lt;h3&gt;
  
  
  Owning your words and problems
&lt;/h3&gt;

&lt;p&gt;I get it. You want to be the best! I want to be the best too, but let’s face it - it’s not possible. We will make mistakes, even if we don’t like it.&lt;/p&gt;

&lt;p&gt;Another great skill is to show you own your mistakes. If you step and fall, acknowledge that and ask for help. Or if someone points out an error you have made - don’t act in your defense. Learn and go on! Improve and adapt!&lt;/p&gt;

&lt;h3&gt;
  
  
  Strong character
&lt;/h3&gt;

&lt;p&gt;What I mean by that - I mean that you have to be strong enough to acknowledge your mistakes and have the ability to ask for help. Overcome your ego and act as stoically as possible!&lt;/p&gt;

&lt;p&gt;Arguments will come at a certain point. There is no way to go through life and not encounter different opinions on how to achieve something.&lt;/p&gt;

&lt;p&gt;Learn to discuss and provide arguments. Learn to explain yourself and present the approach. Also learn to retrieve information. If the opposite idea is just better - use it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;leaders empower!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's funny - the “aha” moment I had when I understood and found out about myself. I am not just a code monkey and just a junior is the moment I said with confidence - “I don’t know and I have no idea how to implement that” with confidence. Nobody knows everything.. and no one should try to.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;The bad example from Real life&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;I had a colleague I worked with in the past that lacked the three of these characteristics. He changed so many projects around the company. Nobody wanted to work with him. He was a horrible guy and I really couldn’t understand why he wasn’t fired.&lt;/p&gt;

&lt;p&gt;He thought he was a great dev, always acting as a “dev God”, but he wasn’t reliable, he didn’t own his mistakes and he absolutely didn’t act as a man.&lt;br&gt;
He raged quit at least four projects, because someone wasn’t taking his arguments and acted as a spoiled child.&lt;br&gt;
It doesn’t matter if you are smart enough. If you suck as a person, nobody will want to work with. What is the point in being great then..?&lt;/p&gt;

&lt;h2&gt;
  
  
  Don’t rely on someone to teach you
&lt;/h2&gt;

&lt;p&gt;Because not many people will care enough to do so. You may find that person, but don’t expect it from a company.&lt;/p&gt;

&lt;p&gt;I met a guy in the past that was trying to learn to code and started applying to companies as soon as possible. That’s great, but he had a major flow. He expected that he needs to know the bare minimum and they will teach him the rest.&lt;/p&gt;

&lt;p&gt;I was like - “Dude.. what the ..?”&lt;/p&gt;

&lt;p&gt;People hire to produce a product or a service and to make money in the end.&lt;/p&gt;

&lt;p&gt;Programming is hard. Real hard. If their business is not around teaching people how to code, don’t expect someone to teach you anything.&lt;/p&gt;

&lt;p&gt;People act as there are “self thought devs” and “not self thought devs”. I don’t understand that thinking. Every dev is self thought. You can have a mentor to guide you and help you, but nobody is going to teach you anything, if that is not in their job description.&lt;/p&gt;

&lt;p&gt;I have had mentors in the past. Even then it’s not certain they will be good enough. My mentor didn’t really care enough..&lt;/p&gt;

&lt;p&gt;Take as much as possible from the projects and the people that work in that project. Examine the code, learn why and how it’s all linked together. Ask &lt;strong&gt;specific questions&lt;/strong&gt; on subjects you are not fully understanding.&lt;/p&gt;

&lt;h2&gt;
  
  
  Write for yourself or the community
&lt;/h2&gt;

&lt;p&gt;We are getting to the interesting part. I started to learn and really understand what I do the moment I started to write everything down.&lt;/p&gt;

&lt;p&gt;It’s easy to get the illusion you are learning only when you are watching some video tutorial or you are reading the documentation.&lt;/p&gt;

&lt;p&gt;You forget almost everything about it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trust me with this one!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I have so many notebooks around me and have written so many docs for some topics I was learning.&lt;/p&gt;

&lt;p&gt;I started writing everything for myself and 95% of the stuff I have written are private and not in “article format”. It’s just an explanation of what I am learning about.&lt;/p&gt;

&lt;p&gt;But writing works. It clarifies your thoughts. It forces you to examine and dive deeper because at some point you encounter a problem you can’t really describe.&lt;/p&gt;

&lt;p&gt;That forces you to go lower and deeper.&lt;/p&gt;

&lt;p&gt;You will forget some stuff, but it will be easier to retrieve again and certainly you will remember a lot more than just browsing around.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Coding and writing! Best combo!&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Bad example from my experience&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;I want to give two examples on why you can’t rely only on years and problems you encounter. I can give you actually a lot more, but you will get the point.&lt;/p&gt;

&lt;p&gt;The first one is seven years of development. PHP developer who was working on numerous projects through the years, but never actually learned anything new. He believed that working alone is enough. The moment he tried to find a new job - he quickly learned that he was not the best candidate for a lot of the jobs. A lot of years, you may think, he will find a job the moment he wants. Well, the moment I am writing this article, it’s been a year and he is still in the same job. Still refusing to believe it’s his fault.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;I have the years, they are wrong&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The second example is kind of the same. Five years, but still the same picture. This guy thinks he is great, but is always asking someone for advice and can’t really act on his own. Even for the basic problems.&lt;/p&gt;

&lt;p&gt;A man with three years less is helping and advising him.&lt;/p&gt;

&lt;p&gt;Can you guess who is being promoted soon? The more “&lt;strong&gt;senior&lt;/strong&gt;” one or the more “mid” dev?&lt;/p&gt;

&lt;h2&gt;
  
  
  Mentor someone
&lt;/h2&gt;

&lt;p&gt;How can I mentor someone if I am not that great as well? Well… you will have to prepare the information beforehand, learn it and try to present it in a digestible format.&lt;/p&gt;

&lt;p&gt;That’s connected to writing.&lt;/p&gt;

&lt;p&gt;In order to teach someone, you have to know your stuff. In order to know it, you have to obtain every information possible. That means you will have to learn a lot!&lt;/p&gt;

&lt;p&gt;You become better by teaching others.&lt;/p&gt;

&lt;p&gt;Do you remember how we said that nobody is going to teach you anything? In my experience it’s true.&lt;/p&gt;

&lt;p&gt;And the moment you become that person.. oh boy. You will be skyrocketing yourself to the Moon. The competition is almost non-existent here.&lt;/p&gt;

&lt;p&gt;Believe me - it’s hard! People love to take the easy road.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;DULCIUS EX ASPERIS&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As the Romans were saying - it’s way Sweeter after difficulties.&lt;/p&gt;

&lt;h2&gt;
  
  
  Overcome the impostor syndrome
&lt;/h2&gt;

&lt;p&gt;It's scary to start mentoring and teaching someone. I know, I know..&lt;/p&gt;

&lt;p&gt;There are people out there that are way smarter than you and me. So much smarter.&lt;br&gt;
But remember that we grow and learn all the time. And we live in a world that has a place for everyone. We can do better. We can be better.&lt;/p&gt;

&lt;p&gt;Even if there are haters, that doesn’t mean we are not helping someone who is just starting out.&lt;/p&gt;

&lt;p&gt;Never be embarrassed of not knowing something. There are always going to be gatekeepers and there are always going to be haters, but nothing’s gonna matter in 150 years, right?&lt;/p&gt;

&lt;p&gt;So why should that stop us from expressing ourselves and learning and teaching?&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I promised you a number. In my own experience and the collective information of the people around me I came up with a number. It’s not an official research, but a simple gathering of information that showed me that of almost 200 people, only 3 did what I am describing ( I am not including myself here ). - It means only 1.5% of the people actually do this and let me tell you this.&lt;/p&gt;

&lt;p&gt;These people may not be the best programmers in the world ( although I can say they are way above average ), but also take leading roles, people respect them and have a great career.&lt;br&gt;
It may be luck or a coincidence, but people feel them as authorities.&lt;/p&gt;

&lt;p&gt;To sum it up - being in the top is way harder and growing there requires skills that exceed our comfort zone.&lt;br&gt;
To start writing blogs, teaching, leading conferences and so on is not something people imagine when it comes to coding.&lt;br&gt;
Having great debugging skills and writing tests is awesome, but unfortunately not enough.&lt;/p&gt;

&lt;p&gt;it really depends where you see yourself in five years. Everything takes time and it’s damn hard.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I wish you luck!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>career</category>
      <category>webdev</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>How I Set Up Husky Pre-Commits in Angular Projects in Just 3 Simple Steps in 2023</title>
      <dc:creator>Dimitar Stoev</dc:creator>
      <pubDate>Tue, 07 Mar 2023 07:12:41 +0000</pubDate>
      <link>https://forem.com/dimitarstbc/how-i-set-up-husky-pre-commits-in-angular-projects-in-just-3-simple-steps-in-2023-gn1</link>
      <guid>https://forem.com/dimitarstbc/how-i-set-up-husky-pre-commits-in-angular-projects-in-just-3-simple-steps-in-2023-gn1</guid>
      <description>&lt;p&gt;Are you tired of finding code issues after they've made their way into your project? It's like finding a sock in the laundry after you've already put it in the dryer. You wish you could catch problems before committing your code, right? Well, you're in luck! In this article, I'll show you how to set up Husky pre-commits for your Angular projects, allowing you to catch issues before they become a bigger problem.&lt;/p&gt;

&lt;p&gt;Before we dive in, let's talk about why you need Husky. Most developers don't think about code quality until it's too late, but I believe in taking a proactive approach to code quality. By setting up Husky pre-commits, you can catch issues before they make their way into your codebase, saving you time and hassle down the line.&lt;/p&gt;

&lt;p&gt;Great! Now that we have set up Husky, let's take it a step further and integrate Commitzen. With Commitzen, we can ensure that our commit messages are consistent, descriptive, and follow a standard format. This makes it easier for other developers to understand the changes that have been made to the codebase.&lt;/p&gt;

&lt;p&gt;Integrating Commitzen with Husky is a simple process that can make a big difference in your development workflow. Let's get started!&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Setting Up Commitizen
&lt;/h2&gt;

&lt;p&gt;As mentioned earlier, Commitizen is a tool that helps you write standardized commit messages using the conventional commits specification.&lt;/p&gt;

&lt;p&gt;To get started, we need to install Commitizen as dev dependencies. In your terminal, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install commitizen --save-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once installed, we need to add a new script to our package.json file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"scripts": {
   "commit": "cz"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you make a commit, you'll be prompted to fill out some information about your commit, such as the type of change, a short description, and a longer description. The prompts are designed to guide you in writing a well-formatted commit message that follows the conventional commits specification.&lt;/p&gt;

&lt;p&gt;Once you've filled out the prompts, your commit message will be automatically formatted based on the conventional commits specification. You can check this by running the git log command. I absolutely LOVE that!&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Setting Up Husky Pre-Commits
&lt;/h2&gt;

&lt;p&gt;Ensures Code Quality Before Committing!&lt;/p&gt;

&lt;p&gt;By setting up Husky pre-commits for your Angular projects, you can catch issues before they make their way into your codebase. This ensures that your code is of high quality before committing it to your repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install husky --save-dev

npx husky install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will install husky after node module installation with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"scripts": {
   "postinstall": "husky install"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Setting Up Tests with Husky
&lt;/h2&gt;

&lt;p&gt;In order to run tests, we need to set up a script that can be executed with a single command. In this case, we'll be using the "test:headless" script. This script is used to run tests in a headless browser environment, which means that there is no graphical interface for the browser. This makes it faster and more efficient to run tests.&lt;/p&gt;

&lt;p&gt;This command will run tests using the Angular CLI's built-in testing framework. We've added the "--watch=false" flag to ensure that the tests only run once, rather than in watch mode, which would keep the tests running continuously.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"scripts": {
   "test:headless": "ng test --watch=false --browsers=ChromeHeadless"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To add the pre-commit hook, we'll use the "npx husky add" command. Here's an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx husky add .husky/pre-commit "npm run test:headless"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Finally: Test your setup
&lt;/h2&gt;

&lt;p&gt;With Husky pre-commit and linting set up, you can now test your setup to ensure it's working as expected. To do this, make a change to one of your .ts files and attempt to commit your changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advice
&lt;/h2&gt;

&lt;p&gt;Take Control of Your Code Quality!&lt;/p&gt;

&lt;p&gt;By following these three simple steps, you can set up Husky pre-commits for your Angular projects and start catching issues before they make their way into your codebase. Don't wait until it's too late to start taking proactive measures for code quality. With Husky pre-commits, you can catch issues early, enforce code quality standards, and streamline your development process.&lt;/p&gt;

</description>
      <category>angular</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How I structure my Angular applications</title>
      <dc:creator>Dimitar Stoev</dc:creator>
      <pubDate>Mon, 27 Feb 2023 10:39:02 +0000</pubDate>
      <link>https://forem.com/dimitarstbc/how-i-structure-my-angular-applications-198c</link>
      <guid>https://forem.com/dimitarstbc/how-i-structure-my-angular-applications-198c</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hey there! I am your friendly neighborhood Angular developer. The one who's always tinkering with code, trying to make things faster, better, and more efficient. I've been around the block a few times when it comes to structuring Angular applications, and I'm here to share what I've learned with you.&lt;/p&gt;

&lt;p&gt;Now, I don't want to brag, but I've seen my fair share of poorly-structured Angular apps. You know the ones I'm talking about - they're slow, buggy, and downright painful to work with. But fear not! With the tips and tricks I'm about to share, you'll be able to structure your Angular applications like a pro.&lt;/p&gt;

&lt;p&gt;So, why is structure so important? Well, think about it this way - would you rather have a cluttered, disorganized mess of code to work with, or a streamlined, easy-to-navigate application that just makes sense? I know which one I'd choose (hint: it's not the mess).&lt;/p&gt;

&lt;p&gt;By structuring your Angular application properly, you'll be able to improve its maintainability, make it easier to debug, and even give it a performance boost. Plus, you'll impress all your developer friends with your well-organized code (and who doesn't love a little bit of developer street cred?).&lt;/p&gt;

&lt;p&gt;So, without further ado, let's dive in and talk about how to structure your Angular application like a pro.&lt;/p&gt;

&lt;h2&gt;
  
  
  The importance of structure in Angular applications
&lt;/h2&gt;

&lt;p&gt;Let's talk about the elephant in the room - structure. I know, I know, it's not the most exciting topic in the world. But trust me, when it comes to Angular applications, structure is the backbone that keeps everything running smoothly.&lt;/p&gt;

&lt;p&gt;Picture this: you're working on an Angular app that's so disorganized, you can't even find the files you need without a search party. You're sifting through endless lines of code, trying to figure out where everything goes and how it all fits together. Sounds like a nightmare? It is.&lt;/p&gt;

&lt;p&gt;But here's the thing - it doesn't have to be that way. With a well-structured Angular application, you'll be able to navigate your code like a pro, making changes quickly and easily. Plus, when you inevitably have to come back to the code months or even years down the line, you'll be thanking yourself for setting up that solid structure in the first place.&lt;/p&gt;

&lt;p&gt;Not convinced yet? Well, let me break it down for you. Here are just a few of the benefits of a good structure in your Angular application:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Maintainability: With a well-organized codebase, you'll be able to make updates and changes more quickly, with less chance of breaking anything in the process&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Performance: By organizing your code properly, you can optimize the performance of your Angular app, making it run faster and more efficiently&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Debugging: When something inevitably goes wrong (and trust me, it will), a good structure will make it much easier to track down the problem and fix it&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Don't underestimate the power of a good structure in your Angular application. It may not be the most exciting topic, but it's one that can save you countless hours of frustration and headaches in the long run. Trust me, your future self will thank you for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Modular Structure
&lt;/h2&gt;

&lt;p&gt;When it comes to structuring your Angular application, one of the most important things to consider is modularity. By breaking your app into smaller, more manageable modules, you'll be able to keep your code organized and maintainable. Plus, it makes it easier to reuse code and collaborate with other developers.&lt;/p&gt;

&lt;p&gt;Here's my suggested modular structure for an Angular app:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Flrxn5ayjyrydywpj4fif.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Flrxn5ayjyrydywpj4fif.png" alt="Angular structure" width="800" height="810"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;core module&lt;/strong&gt; contains services and other code that is used throughout the entire application. This includes things like authentication, logging, and other core functionality. By separating this code into its own module, we can ensure that it's available to all other parts of the app.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;shared module&lt;/strong&gt; contains components, directives, pipes, models, and other code that is shared between multiple feature modules. This includes things like navigation bars, footer sections, and other UI elements that appear on multiple pages. By separating this code into its own module, we can ensure that it's easy to reuse and maintain.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;constant-data&lt;/strong&gt; folder is a good place to store data that remains constant throughout the application. For example, you might have an array of options that is used in multiple places within the app. Instead of duplicating this array in each component or service that uses it, you can define it once in a file within the constant-data folder and then import it wherever it's needed. This not only reduces duplication of code but also makes it easier to maintain the data if it needs to be updated or changed. It's a good practice to keep your code DRY (Don't Repeat Yourself) and the constant-data folder is one way to achieve that.&lt;/p&gt;

&lt;p&gt;In the &lt;strong&gt;"feature"&lt;/strong&gt; module, we have a folder called &lt;strong&gt;"components"&lt;/strong&gt; that we use to store what we call "dumb components". These are components that don't have any business logic or state management of their own, but are purely responsible for rendering data that they receive from a parent component.&lt;/p&gt;

&lt;p&gt;For example, let's say we have a "feature" component that needs to display a list of items. We would create a child component called "item-list" and place it in the "components" folder. The "item-list" component would take an &lt;strong&gt;input&lt;/strong&gt; from the parent &lt;strong&gt;"feature"&lt;/strong&gt; component that contains the list of items to display, and simply render them in the template.&lt;/p&gt;

&lt;p&gt;By keeping these &lt;strong&gt;"dumb components"&lt;/strong&gt; separate from the &lt;strong&gt;"smart components"&lt;/strong&gt; that &lt;strong&gt;have business logic&lt;/strong&gt; and state management, we can create a clearer separation of concerns and make our code easier to maintain and debug. Plus, by giving each component a clear and specific responsibility, we can make our code more reusable and flexible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Feature-specific&lt;/strong&gt; services are services that are used within a specific feature of your application. These services provide functionality that is unique to the feature and are not shared with other parts of the application. By separating feature-specific services into their own folders, you can keep the code for each feature organized and easier to maintain. It also helps to reduce the potential for naming conflicts, as the services are contained within their own folder and are less likely to collide with other services.&lt;/p&gt;

&lt;p&gt;Feature-specific services can include data services, which are responsible for retrieving and manipulating data related to the feature, as well as other services that provide specific functionality related to the feature. Using feature-specific services can make your code more modular, easier to understand and maintain, and can help reduce the overall complexity of your application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Routing and Lazy Loading in Modular Structure
&lt;/h2&gt;

&lt;p&gt;When it comes to organizing your Angular application, modular structure is a great way to keep things organized and maintainable. But there are some additional techniques you can use to make your app even more efficient, such as routing and lazy loading.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating and Organizing Routes in Modular Structure
&lt;/h2&gt;

&lt;p&gt;Routing is essentially the process of navigating between different pages or views within your Angular app. And when you're using a modular structure, it makes sense to keep each feature module's routes separate from the rest of the app.&lt;/p&gt;

&lt;p&gt;To do this, you can create a separate routing module for each feature module. In that routing module, you can define the routes specific to that feature, so you don't have to worry about all the routes for the entire app being in one giant file.&lt;/p&gt;

&lt;p&gt;One of the key benefits of this approach is that it keeps things much more organized and maintainable. You don't have to scroll through a huge file just to find the routes for a specific feature.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of Lazy Loading and How to Implement it in a Modular Structure
&lt;/h2&gt;

&lt;p&gt;Lazy loading is another technique that can be incredibly useful, especially for larger Angular applications. Essentially, it allows you to load only the parts of your app that are actually needed at runtime, rather than loading everything up front.&lt;/p&gt;

&lt;p&gt;So how do you implement lazy loading in a modular structure? Well, it's actually pretty straightforward. You can use the &lt;strong&gt;loadChildren&lt;/strong&gt; property of the &lt;strong&gt;Routes&lt;/strong&gt; object to specify a feature module to load lazily.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fd6gijg34jtsvm31u95xi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fd6gijg34jtsvm31u95xi.png" alt="Lazy loading Angular" width="800" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In other words, when a user tries to navigate to a particular feature, that feature's module will be loaded only when it's actually needed. This can dramatically improve the performance of your app, especially for users who might not need to use all of its features.&lt;/p&gt;

&lt;p&gt;Overall, combining modular structure with routing and lazy loading is a powerful way to create an efficient and maintainable Angular application. So if you're not already using these techniques, it's definitely worth giving them a try!&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Well, that's it for my tips on organizing your Angular application using modular structure. I hope you found this blog post helpful, and that you can use these ideas to create more efficient and maintainable apps.&lt;/p&gt;

&lt;p&gt;Remember, good organization is crucial for any software project, and Angular is no exception. By breaking your app down into modules, organizing your routes, and using lazy loading, you can create an app that's much easier to work with in the long run.&lt;/p&gt;

&lt;p&gt;If you have any questions or comments about this post, please don't hesitate to get in touch! You can find me on Twitter at &lt;a href="https://twitter.com/Dimitar__Stoev" rel="noopener noreferrer"&gt;@Dimitar__Stoev&lt;/a&gt;, or you can reach out to me through my &lt;a href="https://www.stoev.dev/contact" rel="noopener noreferrer"&gt;contact page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thanks for reading, and happy coding!&lt;/p&gt;

</description>
      <category>regex</category>
      <category>markdown</category>
      <category>softwaredevelopment</category>
      <category>programming</category>
    </item>
    <item>
      <title>What is Blockchain</title>
      <dc:creator>Dimitar Stoev</dc:creator>
      <pubDate>Fri, 17 Feb 2023 14:27:45 +0000</pubDate>
      <link>https://forem.com/dimitarstbc/what-is-blockchain-19dk</link>
      <guid>https://forem.com/dimitarstbc/what-is-blockchain-19dk</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;There is a lot of information when it comes to cryptocurrencies, but blockchain in general is a little bit behind. The buzz  around money is always topping the news and the media.&lt;/p&gt;

&lt;p&gt;Blockchain itself is a complex technology that could be described in an easy way. It is a special kind of computer code that helps keep things safe and fair. We can describe it as a big book or a spreadsheet that can store important information.&lt;/p&gt;

&lt;p&gt;It is important to point out that writing to that spreadsheet is permissioned to a specific group, but could be “unlocked” and public. In that way everybody can see the blocks.&lt;/p&gt;

&lt;p&gt;The block is the building material in the blockchain. Once the block is filled with information, it’s stored after the previous block in the chain and gives the iconic name of the technology.&lt;/p&gt;

&lt;h2&gt;
  
  
  Block size
&lt;/h2&gt;

&lt;p&gt;I mentioned the size of the block and now will explain it a little bit further. Different blockchains have different block size limits. The larger the block size limit, the larger is the transaction per second rate. The smaller one is faster, but requires more blocks to make transactions.&lt;/p&gt;

&lt;p&gt;Efficiency is one of the most important topics for blockchain and the size of the blocks are important for that.&lt;/p&gt;

&lt;p&gt;The Bitcoin block size limit is 1 MB, introduced in 2010.&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of blockchain
&lt;/h2&gt;

&lt;p&gt;There are a few types of blockchain. Every one of them has specific use cases and users.&lt;/p&gt;

&lt;h3&gt;
  
  
  Public blockchain
&lt;/h3&gt;

&lt;p&gt;Public blockchains are open in their nature and anybody can use, participate in it. One of the most known are Bitcoin and Ethereum.&lt;/p&gt;

&lt;h3&gt;
  
  
  Private blockchain
&lt;/h3&gt;

&lt;p&gt;Private blockchains are permissioned. Only a specific group of people that are granted access can participate in it.&lt;/p&gt;

&lt;p&gt;Large organizations typically use it for specific internal cases. One example is supply chain management.&lt;/p&gt;

&lt;h3&gt;
  
  
  Consortium blockchain
&lt;/h3&gt;

&lt;p&gt;A consortium blockchain is a hybrid of public and private blockchains. It is controlled by a group of organizations.&lt;/p&gt;

&lt;p&gt;It is often used in finance. Companies can transfer and share data.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does it work?
&lt;/h2&gt;

&lt;p&gt;The transaction cycle is easy to visual&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A person requests a transaction. This is the initialization. It is typically done from a wallet&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The transaction is broadcasted to all participant computers in the specific blockchain, called nodes&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Nodes validate the transaction. This means it is checked if it violates the rules that are set by the blockchain network. For validating, validators receive a reward. Typically a currency&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The transaction is stored and hashed in the block&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The block becomes part of the blockchain and cannot be altered in any way&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The transaction is complete&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ftosw4k0qpszmvnt0vkem.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ftosw4k0qpszmvnt0vkem.jpg" alt=" " width="800" height="475"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Decentralization
&lt;/h2&gt;

&lt;p&gt;This is important for me. The idea of blockchain is to be decentralized. The way it works is that the technology allows the data to be held and spread across many different nodes at various locations.&lt;/p&gt;

&lt;p&gt;If somebody tries to change the data, other nodes won’t validate the alternation.&lt;/p&gt;

&lt;p&gt;Not a single node can hold the control of the network. No government, no big corporations and no single entity. Public blockchains like Bitcoin are important for freedom and establish an exact and transparent order of events. That leads us to..&lt;/p&gt;

&lt;h2&gt;
  
  
  Transparency
&lt;/h2&gt;

&lt;p&gt;Everything is perfectly visible in the blockchain. We can check and see every single bitcoin there is and every transaction that has happened.&lt;/p&gt;

&lt;p&gt;The data is encrypted and only the holder of the key can decrypt it.&lt;/p&gt;

&lt;p&gt;These blocks are immutable and the records are the perfect audit history that allows visibility into past versions of the blockchain.&lt;/p&gt;

&lt;h2&gt;
  
  
  Privacy
&lt;/h2&gt;

&lt;p&gt;When a user makes a transaction, their unique key, a public key, is recorded in the blockchain. The personal information behind that is hidden and unknown. The only way to decrypt it is by social hacking. The real identity is not of a concern to the blockchain.&lt;/p&gt;

&lt;p&gt;The way it works is with public and private keys. A cryptographic key. A string of data that identifies a user and gives access to their wallet. ( the account that stores the information ).&lt;/p&gt;

&lt;p&gt;The public key is stored in the blockchain, while the private one works as a digital signature that unlocks the data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Since there is not a central government or entity that controls the data, the responsibility of storing the private key is to the user. If lost, the access is lost.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Security
&lt;/h2&gt;

&lt;p&gt;Blockchain is secure, but it’s not bulletproof.&lt;/p&gt;

&lt;p&gt;If someone tries to update and alter some information, the cross reference of the nodes will point it out immediately. To succeed, the hacker has to have control of over 50% of the nodes.&lt;/p&gt;

&lt;p&gt;This is called the “51% attack” and in theory it is perfectly possible and there are cases for such an attack.&lt;/p&gt;

&lt;p&gt;But on some blockchains it will require an incredible amount of power and technology, equaling a lot of money, that makes it in a sense impossible.&lt;/p&gt;

&lt;h2&gt;
  
  
  Future of blockchain
&lt;/h2&gt;

&lt;p&gt;The technology itself has been there since the 90s, even earlier, but it still hasn't been adopted to the extent to be a perfect replacement for a lot of ideas and technologies.&lt;/p&gt;

&lt;p&gt;Blockchain has a scaling problem that has to be addressed soon. We have tens of billion devices right now and full adoption is not way near.&lt;/p&gt;

&lt;p&gt;I still believe in technology and I know it is going to be part of the future. Maybe not as a payment replacement, but as a store of value.&lt;/p&gt;

&lt;p&gt;Digital gold is a perfect term to explain it.&lt;/p&gt;

&lt;p&gt;Until we address the scaling problem and the transaction amount per second. Until we build the architecture to have decentralized payments, we are not going to use it in our everyday lives.&lt;/p&gt;

</description>
      <category>security</category>
      <category>cryptocurrency</category>
      <category>privacy</category>
    </item>
  </channel>
</rss>
