<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by vijay s on Medium]]></title>
        <description><![CDATA[Stories by vijay s on Medium]]></description>
        <link>https://medium.com/@vijay310301s?source=rss-14c2e9c33bd3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Hg1iUWNQ8ZvkYqVdWHRaDQ.jpeg</url>
            <title>Stories by vijay s on Medium</title>
            <link>https://medium.com/@vijay310301s?source=rss-14c2e9c33bd3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 17:31:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vijay310301s/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Angular Components]]></title>
            <link>https://medium.com/yavar/angular-components-1e940f3f889e?source=rss-14c2e9c33bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e940f3f889e</guid>
            <category><![CDATA[angular-components]]></category>
            <category><![CDATA[components]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[angular-cli]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[vijay s]]></dc:creator>
            <pubDate>Fri, 03 Feb 2023 12:14:20 GMT</pubDate>
            <atom:updated>2023-02-03T12:30:06.011Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>This blog explains the basic concepts of Angular components in detail which gives a good understanding of angular components that must be known to work efficiently while handling components in an Angular application.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZWRjF1RYrJnUw7Db.png" /></figure><h3>Components :</h3><p>The word <strong><em>component</em> </strong>simply means “ <strong><em>Part of a Large Whole </em></strong>”. It also stands in the same meaning in Angular applications. Because Components are the key features of an angular application Which partitions the whole application into multiple small pieces. This partitioning makes the development process easy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B8o6aRpAbWVqAL8SyW5LLw.png" /><figcaption>Image of an Application with many component partitions.</figcaption></figure><h3>Structure of a Component :</h3><p>A component should contain four essential files. They are:</p><ul><li>component.ts file → Entry point of the component.</li><li>component.html file → Responsible for Template.</li><li>component.css file → Responsible for Styling.</li><li>component.specs.ts file → Handles Testing.</li></ul><p>Here we can see the sidebar component :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*vqkAV1EYaEoUyzTM4aQg9Q.png" /><figcaption>Image of sidebar component structure with files.</figcaption></figure><h3>Component creation using angular cli :</h3><p>A component can be generated simply in two steps using angular/cli :</p><h4>Step 1: Go to the project’s root directory :</h4><p>Any angular project must be created with the angular/cli command ng new project_name . It creates a new angular project folder with the name we have given. Our components must be created inside our project folder. So, move to the newly created project folder’s directory.</p><blockquote>Example :</blockquote><p>I have created a new Angular Project named components using the angular/cli command ng new components inside the Blog-Angular folder. So, If I want to create components in my project, I need to move to the components directory as below image :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vSG16ry5P8H4R8B7bkqRYA.png" /><figcaption>The image that shows the Project’s root directory `components`</figcaption></figure><h4>Step 2: Generate component using angular/cli command :</h4><p>Inside the Project’s root directory, we must use the below angular/cli command to generate components :</p><pre>ng g c component_name<br><br><strong>OR</strong><br><br>ng generate component component_name</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5A8-l2yhwkirQvBYRgWobQ.png" /><figcaption>An Image that shows the component creation using angular/cli</figcaption></figure><p>Once we type this command in a terminal, 4 new files will be created under the folder with the name of the component that we have mentioned in the angular/cli command. This component folder will be placed inside the app folder of the Angular project by default.</p><p>An Update also takes place in the <strong>app.module.ts</strong> file while generating this component. Angular/cli automatically adds the component to the AppModule’s declarations Array in order to use that. <strong>Every component that we create must be added to the app module&#39;s declaration Array, Otherwise, the component is Unknown to the application and we can not use it.</strong></p><p>We can see that AppModule’s declarations array contains all the components I have created in the below image. If angular/cli fails to add it to the declaration’s array, we should do it manually.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kpc_CJX2SKd8tTLZKxXK4w.png" /><figcaption>An Image of AppModules declarations Array</figcaption></figure><h3>Creating nesting Components :</h3><h4>FirstWay :</h4><p>If we want to create a new component inside another component’s folder as they are closely related to each other, We can do it easily with the same angular/cli command but the directory should be changed to the existing component’s folder. That means that the current directory should point to the exact folder in which we want to create a new component folder.</p><blockquote>Example</blockquote><p>If we want to create a new component named sub-body inside the body component, then the directory should be pointed to the body folder as in the image below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N_t5jibcRi1-El88N9z-5Q.png" /><figcaption>An Image that shows the creation of nesting components by altering the directory in the terminal.</figcaption></figure><h4>SecondWay :</h4><p>Another way to do the same is by modifying the directory in the angular/cli command. By default, When we set our directory in Project’s folder and create a component, it will generate it inside the <strong>app folder</strong>. So, If we want to create a component inside another component, we should specify the directory in the angular/cli like :</p><pre>ng g c Exact_Directory_Inside_App_Folder/component_name</pre><p>The Angular/cli will look for the directory. If it exists it will create a component folder inside it. If it does not exist, it will create the directory first and then create a component folder inside it.</p><blockquote>Example</blockquote><p>Already I have a <strong><em>sidebar component</em></strong> in my application. If I wish to have a <strong><em>semi-sidebar component</em></strong>, I must specify the directory to the sidebar component’s folder as in the below image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EZdrveiev9nF35dTxk-efA.png" /><figcaption>An Image that shows the creation of nesting components by altering the angular/cli.</figcaption></figure><h3>Basic features of a component :</h3><p>As I already mentioned, the component.ts file is the <strong>entry point</strong> and <strong>building block</strong> of every component. Because this typescript file holds every detail about the component. So, When we say component, It is mainly about the typescript file of that component.</p><p>A newly created component’s typescript file will look like the below image :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*Xl4n_zFNC9zHnloH6ROHZw.png" /><figcaption>An Image that shows the basic features of a component.</figcaption></figure><p>The component has two fundamental features within it. They are :</p><ul><li>Class { … }</li><li>@Component( {} ) Decorator</li></ul><h4><strong>Class { … } :</strong></h4><p>This class holds all the business logic of this component. This class can be used in any other component because it has a exportkeyword attached to it. We can also implement life cycle hooks and dependency injection in the class itself.</p><h4>@Component( { } ) Decorator :</h4><p><strong>@Component( )</strong> is the decorator which holds the meta-data of the class. Usually, a decorator is used to decorate the class or function in which it&#39;s present. Likewise, <strong>@Component( ) </strong>decorator is provided by the <strong>angular/core</strong> library to decorate the components. This decorator takes the Object as a value and that Object has the very basic three key, value pairs. Each property is contributing something to the component. Let us see the very basic three properties and their functionalities.</p><p><strong>1 ) templateUrl :</strong></p><p>It takes the string value which is the reference to the other file which contains the template ( HTML ) of this typescript file.</p><p>This HTML file is already created by the angular/cli within the same folder when we create the component and that reference is directly provided in the selector value by default.</p><blockquote>Example :</blockquote><p>When I created the header component through the angular/cli command, the .html file is also generated and the reference is provided in the selector.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bxk1BBQjU-GF1Wml" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eH0JCtJBc8QWnm8d" /><figcaption>An Image that explains the templateUrl property of the <strong>@Component( ) </strong>directive.</figcaption></figure><p><strong>2 ) styleUrls :</strong></p><p>styleUrls takes the Array as a value and that array holds the string that references the external style sheet. While creating the component with angular/cli, the stylesheet is also created and that reference is added to this styleUrls array by the cli itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tsd2vZ03cpT_8-VXsc_SyA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DdtMtc8sbqRb8LY23mMJ7A.png" /><figcaption>An Image that explains the styleUrls property of the <strong>@Component( ) </strong>directive.</figcaption></figure><p>We can have multiple stylesheets for the single component and the references should be provided to this styleUrls array but the last stylesheet reference we added to the styleUrls array will be applied to the component’s template.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_wxmerC9zqKQhs32Uyn_rw.png" /><figcaption>An Image that explains the styleUrls property of the <strong>@Component( ) </strong>directive.</figcaption></figure><p><strong>3 ) Selector :</strong></p><p>selector property takes the value as a string that holds the name of this component in order to use this component in another component’s template as an element. The selector name should be unique.</p><p>As usual, when we create the component using angular/cli, the selector will be the part of the <strong>@Component( ) </strong>decorator with the name of the component we create prefixed with the word `app`</p><blockquote>Example :</blockquote><p>When I create a header component, the selector is created as mentioned in the below Image :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GbnpjShmllvcNHvFNWa1Vw.png" /><figcaption>An Image that explains the selector property of the <strong>@Component( ) </strong>directive.</figcaption></figure><h3>Using the Component with its selector :</h3><p>AppComponent is the root component of the Angular application which is rendered first. So the AppComponent’s template ( app.component.html ) will be the initial page of our application. So we must link the other created component to the component.</p><p>We may create a component and complete the template, stylings, and business logic of that without any further alteration. But, it will not get displayed before we decide where to position the component. That’s where selectors came into play. We can decide where to place our component in the application using the selectors.</p><h4>Three Ways of using the Selectors :</h4><p>We can use the component’s selectors in three ways mentioned below :</p><p><strong>1 ) Html Element method :</strong></p><p>This is the default and common method that angular/cli provides. In this method, the selector value should be the normal string in the component&#39;s decorator without any additional notations as below :</p><pre>## .._component.ts<br><br>@component({<br>selector : &#39;name_of_the_selector&#39;<br>})</pre><p>So we can use this selector name as the Html element notation in any other component’s template as below :</p><pre>## .._component.html file :<br>.<br>.<br>.<br>&lt;name_of_the_selector&gt;&lt;name_of_the_selector&gt;<br>.<br>.<br>.</pre><p><strong>2 ) Attribute method :</strong></p><p>In this Attribute method, the selector value is still a string but the name of the selector should be connected with the [] notation as below:</p><pre>## .._component.ts<br><br>@component({<br>selector : &#39;[name_of_the_selector]&#39;<br>})</pre><p>So we can use this component by using the name of the selector as the Attribute of an Html element as below :</p><pre>## .._component.html file :<br>.<br>.<br>.<br>&lt;div name_of_the_selector &gt; &lt;/div&gt;<br>.<br>.<br>.</pre><p><strong>3 ) Class method :</strong></p><p>In the class method, the selector value is a string with the .( period ) notation as below :</p><pre>## .._component.ts<br><br>@component({<br>selector : &#39;.name_of_the_selector&#39;<br>})</pre><p>So we can use this component in an Html element with the class attribute as below :</p><pre>## .._component.html file :<br>.<br>.<br>.<br>&lt;div class=&quot;name_of_the_selector&quot; &gt; &lt;/div&gt;<br>.<br>.<br>.</pre><blockquote><strong>Example :</strong></blockquote><p>Consider that I have created the HeaderComponent, BodyComponent, and FooterComponent and need to display those three in the appComponent’s template ( app.component.html ). I can do it in any of three ways respectively HTML-element method, attribute method, and class method as shown in the below images.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nlykWSK42auxoqLMen7rjg.png" /><figcaption>An Image that explains the Html-element selector.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5YSWCKrs9sKv1D8xoey3yw.png" /><figcaption>An Image that explains the Attribute selector.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cn2UI4IyifkK7P6neSV7Eg.png" /><figcaption>An Image that explains the class selector.</figcaption></figure><p>So I can find the result as follows according to the components I have created :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2uGcr739JM2q_SfaYKLfIw.png" /></figure><blockquote><strong><em>These are all the very basic concepts of Components that every Angular developer should know before developing the application. This basic level of understanding of Components is not enough to create an application. I hope this will clarify the very basic concepts and help in component interactions and further more advanced implementation of components in application development.</em></strong></blockquote><blockquote>Components approximately help to cut the Angular application into pieces…</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e940f3f889e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/angular-components-1e940f3f889e">Angular Components</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular Components — தமிழில்]]></title>
            <link>https://medium.com/yavar/angular-components-%E0%AE%A4%E0%AE%AE%E0%AE%BF%E0%AE%B4%E0%AE%BF%E0%AE%B2%E0%AF%8D-e568de8fd282?source=rss-14c2e9c33bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/e568de8fd282</guid>
            <category><![CDATA[angular-tamil]]></category>
            <category><![CDATA[angular-cli]]></category>
            <category><![CDATA[angular-components]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[vijay s]]></dc:creator>
            <pubDate>Fri, 03 Feb 2023 12:12:10 GMT</pubDate>
            <atom:updated>2023-02-03T12:12:10.715Z</atom:updated>
            <content:encoded><![CDATA[<h3>Angular Components — தமிழில்</h3><blockquote>இந்த <strong>Medium </strong>வலைப்பதிவு <strong>Angular</strong> கட்டமைப்பின் ( <strong>Framework </strong>) அதி முக்கிய உறுப்பாகிய <strong>components </strong>( பகுதிகள் அல்லது பிரிவுகள் ) பற்றிய அடிப்படைத் தகவல்களை தெளிவாக விளக்குவதன் மூலம் , <strong>Angular application </strong>— இல் <strong>components </strong>— ஐ திறம்பட கையாளத் தேவையான புரிதலை வழங்குகிறது.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZWRjF1RYrJnUw7Db.png" /></figure><h3>Components ( பிரிவுகள் ) :</h3><p>component என்ற ஆங்கிலச் சொல்லின் பொருளானது Part of a Large Whole என்பதாகும். அதாவது முழுமையின் ஒரு பகுதி என்பதாகும். பகுதி என்ற இதே பொருளில் தான் Angular செயல்பாட்டிலும் components பயன்படுத்தப்படுகின்றன . ஒரு முழு செயல்பாட்டை ( Application ) பல்வேறு சிறு பகுதிகளாக பிரித்து செயலாற்ற component உதவுகின்றன . components — இன் இந்த செயல்பாடு , Application development — ஐ எளிதாக்குகிறது.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B8o6aRpAbWVqAL8SyW5LLw.png" /></figure><h3>Component — இன் பகுதிகள் :</h3><p>ஒரு <strong>component </strong>கீழ்கண்ட நான்கு கோப்புகளை ( <strong>files </strong>) தன்னடக்கமாக கொண்டிருக்கும் :</p><ul><li><strong>component.ts file</strong> → இது ஒரு Component — இன் முகப்பு போன்றது .</li><li><strong>component.html → </strong>இது திரையில் புலப்படும் html பக்கத்தை பதிவிட உதவும் ( Template ).</li><li><strong>component.css → </strong>இது html பக்கத்தை மெருகூட்ட உதவும் ஒப்பனை பக்கமாகும் ( Styling ).</li><li><strong>component.specs.ts file</strong> <strong>→ </strong>இது சோதனைக்கானப் பக்கமாகும் ( Testing ).</li></ul><p><strong><em>sidebar component </em></strong>— இன் அமைப்பு கீழே கொடுக்கப்பட்டுள்ளது :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*vqkAV1EYaEoUyzTM4aQg9Q.png" /></figure><h3>Angular /cli — ஐப் பயன்படுத்தி component உருவாக்கம் :</h3><p>கீழே குறிப்பிடப்பட்டுள்ள இரண்டு எளிய படிநிலைகள் மூலம் component — ஐ உருவாக்க இயலும் :</p><h4>படி 1 : Terminal — இல் Angular செயலின் சரியான மூல வழியைத் ( Path of the Project folder ) தேர்வு செய்தல் :</h4><p>எந்த ஒரு <strong>Angular </strong>செயலியையும் ng new Project_name என்ற Angular /cli command — ஐ பயன்படுத்திதான் உருவாக்க முடியும். அவ்வாறு உருவாக்கப்பட்ட புதிய Angular செயலியானது , தன்னகத்தே பல்வேறு கோப்புகளை கொண்ட ஒரு கோப்புறையாக ( <strong><em>project Folder</em></strong> ) , நாம் தீர்மானித்த பெயரில் அமைந்ததிருக்கும். புதிதாக உருவான இந்த <strong>project Folder</strong> எனப்படும் கோப்புறைக்குள்ளாகத்தான் நாம் நமக்குத் தேவையான <strong>components </strong>— ஐ உருவாக்க வேண்டும் . ஆகவே நாம் <strong>components </strong>-ஐ உருவாக்குவதற்கான <strong>Angular /cli</strong> கட்டளையை ( <strong>command </strong>) <strong>Terminal </strong>— இல் உள்ளிடுவதற்கு முன்பாக , நாம் தற்போது இருக்கும் <strong>Terminal </strong>பாதை புதிதாக உருவாக்கப்பட்ட <strong>project Folder </strong>— ஐ குறிப்பதாக இருப்பதை உறுதி செய்ய வேண்டும் .</p><p>உதாரணமாக , நான் <strong>components </strong>என்ற பெயரில் ஒரு புதிய <strong>Angular </strong>செயலியை <strong>Blog -Angular</strong> என்கின்ற கோப்புறையுனுள் இருந்து ng new components என்ற <strong>Angular /cli</strong> கட்டளையை உள்ளீடு செய்ததன் மூலமாக உருவாக்கி இருக்கிறேன். இப்போது <strong>components </strong>என்கின்ற புதிய <strong>Angular </strong>செயலிக்குள் நான் <strong>component </strong>— ஐ உருவாக்க விரும்பினால் , எனது <strong>Terminal </strong>— இல் பாதையை கீழ்கண்ட படத்தில் உள்ளபடி அமைக்க வேண்டும் .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vSG16ry5P8H4R8B7bkqRYA.png" /></figure><h4>படி 2 : component — ஐ உருவாக்குவதற்கான Angular /cli கட்டளையை Terminal — இல் உள்ளீடு செய்தல் :</h4><p>நாம் சரியான <strong>Terminal </strong>பாதையில் உள்ளோம் என்பதனை உறுதி செய்த பிறகு , கீழே குறிப்பிடப்பட்டுள்ள <strong>component </strong>உருவாக்கத்திற்கான இரண்டு <strong>Angular /cli </strong>கட்டளைகளின் பொது வடிவங்களில் இருந்து ஒன்றை பயன்படுத்தி <strong>component </strong>— ஐ நம்மால் உருவாக்க இயலும் .</p><pre>ng g c component_name<br><br><strong>OR</strong><br><br>ng generate component component_name</pre><p>நான் <strong>demo-component</strong> என்ற பெயரில் ஒரு புதிய <strong>component </strong>— ஐ <strong>components </strong>என்கின்ற செயலிக்குள் உருவாக்கி இருப்பதைக் கீழே உள்ள படத்தில் காணலாம் .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5A8-l2yhwkirQvBYRgWobQ.png" /></figure><p>மேலே உள்ள படத்தில் <strong>component </strong>உருவாக்கம் வெற்றிகரமாக <strong>Angular /cli </strong>கட்டளை மூலம் நிறைவேற்றப்பட்டுள்ளது. இதன் விளைவாக <strong>demo -component</strong> என்கின்ற புதிய கோப்புறை நான்கு கோப்புகளை உள்ளடக்கமாக கொண்டு ,<strong> Angular project Folder</strong> — இன்<strong> app Folder </strong>— குள் உருவாகி இருப்பதைக் காண முடிகிறது.</p><p>இது தவிர ஏற்கனவே <strong>Angular project Folder</strong> — இல் அங்கம் வகிக்கும் <strong>App .module .ts</strong> என்ற கோப்பில் ஒரு மேம்பாடு ( <strong>UPDATE</strong> ) நடந்திருப்பதையும் படத்தில் நாம் காணலாம் . நாம் உள்ளீடு செய்த <strong>Angular /cli</strong> கட்டளையானது , <strong>AppModule</strong> எனப்படும் மிக முக்கிய கோப்பில் இருக்கும் <strong>declarations Array [ ]</strong> என்கின்ற அறிவிப்பு வரிசைக்குள் நம் புதிய <strong>component</strong> — ஐயும் சேர்த்துள்ளது . இதுவே ஒரு மேம்பாடாக நமக்கு தெரிவிக்கப்பட்டுள்ளது . இது போன்று நம் <strong>Angular </strong>செயலிக்குள் இருக்கும் அத்தனை <strong>component </strong>— களும் <strong>AppModule </strong>— இன் <strong>declarations Array[ ]</strong> என்கின்ற அறிவிப்பு வரிசைக்குள் இடம் பெற்றிருக்க வேண்டியது மிகவும் அவசியமான <strong>Angular </strong>விதிகளை ஒன்றாகும் . அப்படி தவறும் பட்ச்சத்தில் , நம் <strong>component </strong>— ஐ நம்மால் பயன்படுத்த முடியாமல் போகும்.</p><p>ஏற்கனவே<strong> Angular project Folder</strong> — னுள் இருக்கும் <strong>AppComponent</strong> உட்பட நான் உருவாக்கிய மற்ற எல்லா <strong>component </strong>— களும் , <strong>AppModule</strong> — இன்<strong> declarations Array [ ]</strong> — வில் இடம் பெற்றிருப்பதை கீழ்கண்ட படத்தில் காணலாம். ஒரு வேலை <strong>Angular /cli</strong> இந்த மேம்பாட்டை ( <strong>UPDATE </strong>) நிகழ்த்தவில்லை எனும் போது நாமாக இந்த <strong>declarations Array [] </strong>— வுக்குள் நம் component — ஐ சேர்த்தாக வேண்டும் .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kpc_CJX2SKd8tTLZKxXK4w.png" /></figure><h3>அடுக்கு components ( Nesting components ) — களை உருவாக்குதல் :</h3><h4>முதல் வழிமுறை :</h4><p>ஒரு <strong>component </strong>— ஆனது , மற்றொரு <strong>component </strong>— உடன் நெருங்கியத் தொடர்பை பெற்றுள்ளதெனில் , அந்த புதிய <strong>component </strong>— ஐ ஏற்கவே இருக்கும் <strong>component </strong>— இன் உள்ளடக்கமாக உருவாக்க வேண்டி வரும். அதனை <strong>component </strong>உருவாக்கத்திற்கான <strong>Angular /cli </strong>கட்டளையை ng g c component_name, ஏற்கவே இடம்பெற்றிருக்கும்<strong> component folder</strong> — இன் <strong>terminal </strong>வழியில் இருக்கும்படி உள்ளிடுவதன் மூலம் சுலபமாக அடைய முடியும்.</p><p>உதாரணமாக , நான் <strong>sub-body</strong> என்கின்ற பெயரில் புதிய <strong>component </strong>ஒன்றை , ஏற்கவே உள்ள <strong>body </strong>என்கின்ற <strong>component </strong>— குள் உருவாக்க நினைத்தால் , எனது தற்போதைய <strong>terminal </strong>பாதைத் துல்லியமாக <strong>body </strong>காம்போனென்ட் — ஐ குறிப்பதாக இருக்க வேண்டும் . இதனை கீழ்கண்ட படத்தில் காணலாம் .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N_t5jibcRi1-El88N9z-5Q.png" /></figure><h4>இரண்டாவது வழிமுறை :</h4><p>மேற்கண்ட அடுக்கு <strong>component </strong>— களை உருவாக்குதலை <strong>angular </strong>/<strong>cli </strong>கட்டளையில் <strong>path </strong>— ஐ மாற்றுவதன் மூலமாகவும் செய்ய முடியும் . பொதுவாக நாம் நமது <strong>Project folder directory</strong> -இல் இருந்தபடியே <strong>component </strong>— ஐ உருவாகும் போது , <strong>App Folder </strong>— குள்ளாகத் தான் புதிய <strong>component </strong>ஆனது உருவாக்கப்படும் . நாம் நமது புதிய <strong>component </strong>-ஐ , மற்றுமொரு <strong>component </strong>— குள் உருவாக்க விரும்பினால் கீழ்கண்டவாறு <strong>component </strong>— உருவாக்கத்திற்கான<strong> angular /cli </strong>கட்டளையை மாற்றி அமைக்க வேண்டும் .</p><pre>ng g c Exact_Directory_Inside_App_Folder/component_name</pre><p><strong>Angular /cli </strong>, நாம் உள்ளீடு செய்துள்ள <strong>Directory </strong>ஏற்கனவே இருப்பின் அதற்குள் புதிய <strong>component </strong>— ஐ உருவாக்கி விடும் . அப்படி இல்லாமல் இருப்பின் முதலில் அந்த <strong>Directory </strong>— ஐ உருவாக்கி அதற்குள் புதிய <strong>component </strong>— ஐ உருவாகும் .</p><p>உதாரணமாக , நான் ஏற்கனவே உள்ள s<strong>idebar component </strong>— குள்ளாக புதிய <strong>semi -sidebar component</strong> — ஐ உருவாக்க விரும்பினால் , <strong>Project Folder Directory</strong> -யில் இருந்த படியே <strong>Component </strong>உருவாக்கத்திற்கான <strong>Angular /cli</strong> கட்டளையை கீழ்கண்டவாறு <strong>Terminal </strong>— இல் உள்ளீடு செய்ய வேண்டும் .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EZdrveiev9nF35dTxk-efA.png" /></figure><h3>Component — இன் மிக முக்கிய அம்சங்கள் :</h3><p>நான் ஏற்கவே குறிப்பிட்டுள்ளதை போல , <strong>component.ts</strong> கோப்பானது ஒரு <strong>Component</strong> — இன் நுழைவு வாயிலை போன்றதாகும். ஏனெனில் ஒரு <strong>Component </strong>குறித்த அணைத்து விவரங்களையும்<strong> component .ts </strong>கோப்பு தான் கொண்டிருக்கும் . ஆகவே <strong>Component </strong>என்றாலே அதன் <strong>typescript </strong>கோப்பு தான் என்று சொன்னாலும் அது மிகை ஆகாது .</p><p>புதிதாக<strong> Angular /cli</strong> கட்டளையை பயன்படுத்தி உருவாக்கப்பட்ட <strong>Component </strong>-இன் <strong>typescript </strong>கோப்பு பின்வரும் படத்தில் உள்ளபடி இருக்கும் :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*Xl4n_zFNC9zHnloH6ROHZw.png" /><figcaption>An Image that shows the basic features of a component.</figcaption></figure><p>படத்தில் மேற்கோளிட்டு காட்டியுள்ளதை போல Component இரண்டு முக்கிய அடிப்படை அலகுகளை கொண்டதாக இருக்கும் . அவை பின்வருமாறு :</p><ul><li><strong>Class { … }</strong></li><li><strong>@Component( {} ) Decorator</strong></li></ul><h4>Class { … } :</h4><p><strong>class { … }</strong> என்று சொல்லப்படும் இந்த அமைப்பிற்குள் தான் ,<strong>Component </strong>— கு தொடர்பான அணைத்து <strong>logic </strong>— களும் எழுதப்பட வேண்டும் . இந்த <strong>Component </strong>— காண <strong>class </strong>— ஐ வேறு <strong>Component </strong>— குள்ளாகவும் நாம் பயன்படுத்த முடியும் . ஏனெனில் இதை <strong>export </strong>என்ற <strong>keyword </strong>— ஆல் இணைக்கப்பட்டுள்ளதை நாம் காணலாம் . மேலும் இந்த class — குள்ளாகத்தான் இதர மிக முக்கிய <strong>Angular </strong>அம்சங்களான <strong>Lifecyclehooks </strong>, <strong>Dependency Injection </strong>போன்றவைகளை பயன்படுத்த முடியும் .</p><h4>@Component( { } ) Decorator :</h4><p><a href="http://twitter.com/Component"><strong>@Component</strong></a><strong>( ) decorator </strong>என்று அழைக்கப்படும் இந்த உறுப்பானது <strong>class </strong>மீதான சில குறிப்புகளை ( <strong>meta — data</strong> ) கொண்டிருக்கும் . பொதுவாகவே ஒரு <strong>decorator </strong>என்பது அது பயன்ப்டுத்தப்பட்ட <strong>class </strong>மீதோ அல்லது <strong>function </strong>மீதோ ஆனா <strong>meta — data</strong> வை கொண்டுள்ளதாகத்தான் இருக்கும் .<br><a href="http://twitter.com/Component"><strong>@Component</strong></a><strong>( ) decorator</strong> என்பதும் கூட <strong>Angular /library </strong>— யினால் வழங்கப்பட்ட அது போன்றதொரு <strong>decorator </strong>ஆகும் . இந்த <a href="http://twitter.com/Component"><strong>@Component</strong></a><strong>( ) decorator</strong> ஆனது ஒரு <strong>Object { } </strong>— ஐ உள்ளீடாக பெற்றிருக்கிறது . இந்த <strong>Object { } ,</strong> சில <strong>property </strong>— களையும் <strong>value </strong>— களையும் ஏற்கக்கூடியதாக இருக்கும் . அந்த <strong>property </strong>— கள் ஒவ்வொன்றும் ஒவ்வொரு வகையில் <strong>Component </strong>— இன் செயல்திறனில் பங்கு கொண்டிருக்கும் . அப்படிப்பட்ட <strong>property </strong>— களில் அதி முக்கியமான மூன்றை பற்றிய விளக்கத்தை கீழே காண்போம் :</p><h4><strong>1 ) templateUrl :</strong></h4><p><strong>tempateUrl </strong>எனப்படும் இந்த <strong>property </strong>ஆனது , ஒரு <strong>string </strong>— ஐ இதன் <strong>value </strong>— வாக பெருவதாய் இருக்கிறது . அந்த <strong>string </strong>ஆனது இந்த <strong>Component </strong>— காண <strong>template </strong>— ஐ பதிவிடும் <strong>html </strong>கோப்பை குறிப்பிடுவதாய் இருக்க வேண்டும் .</p><p><strong>Angular /cli </strong>— ஐ பயன்படுத்தி ஒரு <strong>Component </strong>ஐ உருவாக்கினால் , இந்த html கோப்பை உருவாக்குவதோடு மட்டுமல்லாமல் அதற்கான குறிப்பையும் இந்த <strong>templateUrl property </strong>— கு <strong>value </strong>வாக சேர்த்து விடுகிறது .</p><blockquote>உதாரணம் :</blockquote><p><strong>Angular /cli </strong>— ஐ பயன்படுத்தி <strong>header -Component</strong> என்ற பெயரில் ஒரு <strong>Component </strong>— ஐ உருவாக்கும் போது , <strong>header -Component .html</strong> என்ற கோப்பு உருவாகி இருப்பதையும் அதை குறிக்கும் பாதை ( <strong>Path </strong>) <strong>templateUrl property </strong>— இல் <strong>value </strong>— வாக சேர்க்கப்பட்டிருப்பதையும் கீழ்கண்ட படத்தில் காண முடியும் .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bxk1BBQjU-GF1Wml" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eH0JCtJBc8QWnm8d" /><figcaption>An Image that explains the templateUrl property of the <strong>@Component( ) </strong>directive.</figcaption></figure><h4><strong>2 ) styleUrls :</strong></h4><p><strong>styleUrls </strong>என்ற <strong>property </strong>, ஒரு <strong>array </strong>— வை <strong>value </strong>வாக பெறுகிறது . அந்த <strong>array </strong>— வானது பல <strong>string </strong>— களை பெற்றிருக்கலாம் . <strong>templateUrl property </strong>போலவே இந்த <strong>string </strong>— குகள் இந்த <strong>Component </strong>— இன் <strong>styling </strong>காண கோப்பை குறிப்பிடுவதாக இருக்க வேண்டும் . <strong>Angular /cli </strong>மூலமாக உருவாக்கப்படும் எந்த ஒரு <strong>Component </strong>— கும் இந்த <strong>styling </strong>கோப்பு உருவாக்கப்படுவதோடு மட்டுமல்லாமல் ,<strong> styleUrls property</strong> இல் அதன் பாதை <strong>value </strong>வாகவும் சேர்க்கப்பட்டுவிடும் . இதை கீழே உள்ள படத்தில் காணலாம் .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tsd2vZ03cpT_8-VXsc_SyA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DdtMtc8sbqRb8LY23mMJ7A.png" /><figcaption>An Image that explains the styleUrls property of the <strong>@Component( ) </strong>directive.</figcaption></figure><p>ஒரு வேலை நாம் ஒரே <strong>Component </strong>கு பல <strong>styling </strong>கோப்புகளை கொண்டிருக்க விரும்பினால் அதை , <strong>styleUrls property array —</strong> வுக்குள் கொடுத்துக்கொள்ளலாம் . விதிகளின் படி , <strong>array </strong>— வுக்குள் கடைசியாக இடம்பெற்றிருக்கும் கோப்பில் உள்ள <strong>styling </strong>மட்டுமே <strong>Component — </strong>கு பயன்படுத்தப்பட்டிருக்கும் . அதை கீழே உள்ள படத்தில் காணலாம் .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_wxmerC9zqKQhs32Uyn_rw.png" /><figcaption>An Image that explains the styleUrls property of the <strong>@Component( ) </strong>directive.</figcaption></figure><h4><strong>3 ) Selector :</strong></h4><p>மேற்கண்ட இரு <strong>property </strong>— களை போலவே <strong>selector property </strong>— உம் <strong>string </strong>— ஐ <strong>value </strong>— வாக பெறுகிறது . இந்த <strong>string </strong>— ஆனது , இந்த <strong>Component </strong>— இன் பெயரை கொண்டதாக இருக்கும் . அதாவது , இந்த <strong>selector </strong>பெயரை பயன்படுத்தி தான் , நம்மால் இந்த <strong>Component </strong>— ஐ வேறு <strong>Component </strong>— களின் <strong>template </strong>— களில் பயன்படுத்த இயலும் . மேலும் அந்த <strong>selector </strong>பெயர் முற்றிலும் தனித்துவமானதாக ( <strong>unique </strong>) இருந்தாக வேண்டும் .</p><p><strong>Angular /cli </strong>— ஐ பயன்படுத்தி ஒரு <strong>Component </strong>உருவாகும் போது , அந்த <strong>Component </strong>பெயரிலே தனித்துவமான <strong>selector </strong>பெயர் , `<strong>app</strong>` என்னும் முன் இணைப்புடன் உருவாகி <a href="http://twitter.com/Component"><strong>@Component</strong></a><strong> () decorator </strong>— குள்ளாக சேர்க்கப்பட்டு விடும் .</p><blockquote>உதாரணம் :</blockquote><p><strong>header -Component </strong>— ஐ உருவாக்கும் போது சேர்க்கப்பட்ட <strong>selector — property </strong>ஐ பின்வரும் படத்தில் காணலாம் :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GbnpjShmllvcNHvFNWa1Vw.png" /><figcaption>An Image that explains the selector property of the <strong>@Component( ) </strong>directive.</figcaption></figure><h3>Selector — இன் மூலமாக Component — ஐ பயன்படுத்துதல் :</h3><p><strong>AppComponent </strong>என்பது தான் ஒரு <strong>Angular </strong>செயலியின் மூல <strong>Component </strong>ஆகும் . அதனோடு இணைக்கப்படாமல் நாம் எத்தனை <strong>Component </strong>— களை உருவாக்கி அவற்றின் முழு செயலதிறன்களை வரையறுத்து விட்டாலும் கூட அவற்றை நம்மால் பார்க்க ( <strong>can ‘t view in App’s template</strong> ) இயலாது .</p><p>எனவே நாம் நம் <strong>Component </strong>-களை வரையறுத்து விட்டு அதை செயலியின் எந்த இடத்தில பொறுத்த உள்ளோம் என்பதனை முடிவெடுத்துவிட்டால் , <strong>Component selector </strong>— களை கொண்டு மூன்று வெவ்வேறு வழிகளில் அதனை செய்து முடிக்கலாம் .</p><h4>1 ) Html Element வழிமுறை :</h4><p>இந்த வழி முறை தான் மிகவும் பொதுவான , பிரபலமான மற்றும் <strong>Angular /cli </strong>— யினாலே கூட வலியுறுத்தப்படும் வழிமுறையாகும் . இந்த <strong>Html Elemant</strong> முறையில் , <strong>selector </strong>— பெயர் வெறுமனே ஒரு <strong>string </strong>ஆக மட்டுமே இருக்கும் . வேறு எந்த குறியீடுகளும் பெயருடன் பயன்படுத்தப்பட்டிருக்க மாட்டா . அதாவது கீழே உள்ள கட்டமைப்பின் படி இருக்கும் :</p><pre>## .._component.ts<br><br>@component({<br>selector : &#39;name_of_the_selector&#39;<br>})</pre><p>ஆகவே நாம் இந்த <strong>selector </strong>பெயரை வேறு எந்தவொரு <strong>Component template </strong>— லும் , ஒரு <strong>Html element </strong>போல பின்வருமாறு பயன்படுத்தலாம் :</p><pre>## .._component.html file :<br>.<br>.<br>.<br>&lt;name_of_the_selector&gt;&lt;name_of_the_selector&gt;<br>.<br>.<br>.</pre><h4><strong>2 ) Attribute </strong>வழிமுறை <strong>:</strong></h4><p>இந்த <strong>Attribute </strong>முறையில் , <strong>selector </strong>— பெயர் ஒரு <strong>string </strong>ஆக இருக்கும் . மேலும் அந்த பெயர் []— என்ற குறியீடுடன் பிணைக்கப்பட்டதாயிருக்கும் . அதாவது கீழே உள்ள கட்டமைப்பின் படி இருக்கும் :</p><pre>## .._component.ts<br><br>@component({<br>selector : &#39;[name_of_the_selector]&#39;<br>})</pre><p>ஆகவே நாம் இந்த <strong>selector </strong>பெயரை வேறு எந்தவொரு <strong>Component template </strong>— லும் , ஒரு <strong>Html element</strong> — இன் <strong>attribute </strong>போல பின்வருமாறு பயன்படுத்தலாம் :</p><pre>## .._component.html file :<br>.<br>.<br>.<br>&lt;div name_of_the_selector &gt; &lt;/div&gt;<br>.<br>.<br>.</pre><h4>2 ) Class வழிமுறை :</h4><p>இந்த <strong>class </strong>முறையில் , <strong>selector </strong>— பெயர் ஒரு <strong>string </strong>ஆக இருக்கும் . மேலும் அந்த பெயர் .( period )— என்ற குறியீடுடன் பிணைக்கப்பட்டதாயிருக்கும் . அதாவது கீழே உள்ள கட்டமைப்பின் படி இருக்கும் :</p><pre>## .._component.ts<br><br>@component({<br>selector : &#39;.name_of_the_selector&#39;<br>})</pre><p>ஆகவே நாம் இந்த <strong>selector </strong>பெயரை வேறு எந்தவொரு <strong>Component template </strong>— லும் , ஒரு <strong>Html element </strong>— இன் <strong>class </strong>போல பின்வருமாறு பயன்படுத்தலாம் :</p><pre>## .._component.html file :<br>.<br>.<br>.<br>&lt;div class=&quot;name_of_the_selector&quot; &gt; &lt;/div&gt;<br>.<br>.<br>.</pre><blockquote>உதாரணம் :</blockquote><p>நான் என் <strong>Angular </strong>செயலியில் , <strong>header -Component , body -Component </strong>மற்றும் <strong>footer -Component </strong>என்ற மூன்று<strong> Component — </strong>களை யம் உருவாக்கி அவை அனைத்தையும் <strong>App -Component — </strong>இன் <strong>template </strong>— இல் பொறுத்திவிட விரும்பினால் , நான் அதை மேற்குறிப்பிட்ட எந்தவொரு <strong>selector </strong>பெயர் வழிமுறையின் படியும் செய்து முடிக்கலாம் .</p><p>வரிசையாக ஒவ்வொரு வழிமுறையின் படியும் <strong>Component </strong>— களை <strong>appcomponent </strong>— இல் சேர்த்துள்ளதை கீழ்வரும் படங்களில் காணலாம் .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nlykWSK42auxoqLMen7rjg.png" /><figcaption>An Image that explains the Html-element selector.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5YSWCKrs9sKv1D8xoey3yw.png" /><figcaption>An Image that explains the Attribute selector.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cn2UI4IyifkK7P6neSV7Eg.png" /><figcaption>An Image that explains the class selector.</figcaption></figure><p>எனவே என்னுடை <strong>Angular </strong>செயலி ஆனது நான் வரையறுத்த <strong>Component </strong>— களின் செயல்பாடுகளின் படி கீழ்கண்டவாறு இருக்கிறது :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2uGcr739JM2q_SfaYKLfIw.png" /></figure><p><strong>Angular Component </strong>— களின் மீதான அடிப்படை புரிதலை ஏற்படுத்தும் நோக்கில் எழுதப்பட்ட இந்த வலைப்பதிவு ஓரளவு அதனை பூர்த்தி செய்திருக்கும் என நம்புகிறேன் . இது <strong>Component </strong>— களின் மீதான ஒரு அடிப்படை புரிதல் மட்டுமே . ஒரு செயலியை உருவாக்குவதற்கு இதை விட அதிகமான தகவல்களை நாம் தெரிந்து கொண்டிருக்க வேண்டும் .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e568de8fd282" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/angular-components-%E0%AE%A4%E0%AE%AE%E0%AE%BF%E0%AE%B4%E0%AE%BF%E0%AE%B2%E0%AF%8D-e568de8fd282">Angular Components — தமிழில்</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular @Input() and @Output() decorators.]]></title>
            <link>https://medium.com/yavar/angular-input-and-output-decorators-d712f7644088?source=rss-14c2e9c33bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/d712f7644088</guid>
            <category><![CDATA[angular-development]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[components]]></category>
            <category><![CDATA[input-output]]></category>
            <dc:creator><![CDATA[vijay s]]></dc:creator>
            <pubDate>Mon, 23 Jan 2023 05:29:01 GMT</pubDate>
            <atom:updated>2023-01-23T05:35:16.456Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>This blog discusses the interactions between the parent and child components in an Angular project using @Input() @Output() decorators.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cQdI4GSypEsKcyHlE9RGeQ.jpeg" /></figure><p>Hi friend! How is your family? You recalled your home just for a second right? yeah! Every home has its own bonding with the family members. Angular is also a Home because it contains many parent components and child components and lovable conversations between them. @Input() and @Output(), are the two necessary decorators which contribute to the interactions between the components. Let’s discuss how they doing it.</p><p>Before going to learn how to use the decorators for sharing the data between components, I want you to have basic clarifications on two things.</p><p>1 ) Parent component and Child component.</p><p>2 ) @Input() and @Output() decorators depends only on child component.</p><p><strong>1 ) Parent component and Child component:</strong></p><p>As we know earlier, Angular applications can contain multiple components. We can use one component in another with the help of its selectors. Here,</p><p><strong>Parent Component</strong> → Which component has the other component’s selector as an element within its template.</p><p><strong>Child Component </strong>→ Which component’s selector has been used as an element in another component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d72LptciYaE22SJ_Dz5YHw.png" /></figure><p>According to the image above displayed,</p><p><strong>AppComponent acts as Parent Component </strong>as it contains a child-one components selector in its template and <strong>Child-one Component acts as a child component</strong> as its selector is used in another component’s template.</p><p><strong>NOTE: </strong>A parent component can have multiple children as well as a child can have multiple parents.</p><p><strong>2 ) @Input() and @Output() decorators depends only on child component :</strong></p><p>I believe all of us want to be children of our parents even after we get our own children. This mentality will help us to understand the behaviors of the @Input() and @Output() decorators between components. These two decorators work from the children&#39;s component perspective which means,</p><blockquote>@ Input() → <strong>Is Used to Receive data from its Parent Component.</strong></blockquote><blockquote>@Output() → <strong>Is Used to send data to the Parent Component.</strong></blockquote><h3><strong>@ Input() decorator :</strong></h3><p>As I already said, @ Input() decorator is used to receive data from its parent.</p><p>Let us assume that the child component needs the property of type string from its parent to display its template as the below images show:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hyjFAWGGZJrOTTO3bxfDcA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*y9fWXIzKOGNjLpBXdp7bAQ.png" /></figure><p>Let’s get that property with @ Input() decorator step by step :</p><h4>step 1 :</h4><p>Use the @ Input() decorator on the property whose value needs to be received from the parent and import the decorator from the angular core library.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NrkjPq5ePR14eOhZzkE2rQ.png" /></figure><h4>step 2 :</h4><p>We must configure the parent to send the data to its child. We can achieve this by binding the child component’s selector with the property which needs to be shared from the parent as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U2C9X00r2RRLOQ73DM8yNw.png" /></figure><h3>@Onput() decorator :</h3><p>I hope your parents are not strict as Angular Parent components. Angular Parent components are strict because they won’t receive anything simply from their children as they send something simply. Parent components require some Event from their children to respond.</p><p>Let us send one property to the parent component using @Onput() decorator from the children step by step.</p><p>@Onput() decorator acts as the <strong><em>ambassador </em></strong>between the child and the Parent to create the platform called <strong>EventEmiiter </strong>which is responsible for creating custom events.</p><p><strong>Step 1 :</strong></p><p>Decorate the property which is assigned with the EventEmiiter with the @Onput() decorator in the child component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*OjcJFxHbqFKXZSAYkZ92WQ.png" /></figure><p><strong>Step 2 :</strong></p><p>Emit the value from the child component in any method by calling the property which is decorated with @Onput() decorator and emit the value we need to send to the Parent as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*s6HXWKhUkovjTMpkzkFa7Q.png" /></figure><p><strong>Step 3 :</strong></p><p>We must configure the parent component’s template to receive the data from its child. We must bind the event in the selector of the child component as below :</p><p>The event-binding name should be the property name which is decorated with @Onput() decorator in the child component and that should be synced with the customer event of the parent component to get the value from the children.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*OjcJFxHbqFKXZSAYkZ92WQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*y-An5atl-k9NGOh92wH_7A.png" /></figure><p><strong>Step 4 :</strong></p><p>Assign the Received value to the required property in the Parent component and use the property in its template.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*HtvBYCva5Zmhx2zPHAlnNQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*4z-smnwuqZ7Q7XIJqacDhA.png" /></figure><p>I have just passed the String which is “Hungry” from child to Parent and that will look like the below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*puJKs_Ed42iklG_wZESm9w.png" /></figure><p>This is how Parent and child components are interacting with one another in the Angular Home. Now, we have learned how to make the interactions possible between the Parent and child component step by step. I hope this blog helped you to acquire the basic knowledge of <strong>@Input() and @Output() </strong>decorators in angular.</p><p>@@@@@@@@@@@<strong><em> Thannk You !</em></strong> @@@@@@@@@@@</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d712f7644088" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/angular-input-and-output-decorators-d712f7644088">Angular @Input() and @Output() decorators.</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying angular application in firebase.]]></title>
            <link>https://medium.com/yavar/deploying-angular-application-in-firebase-111d001bdfde?source=rss-14c2e9c33bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/111d001bdfde</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[angular-cli]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[projects]]></category>
            <dc:creator><![CDATA[vijay s]]></dc:creator>
            <pubDate>Sat, 10 Dec 2022 10:29:01 GMT</pubDate>
            <atom:updated>2022-12-11T08:16:02.960Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>This blog clearly explains each and every step to deploy an angular application in firebase in a manner that everyone can understand.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TWd-5UTzWLpvIE8h_udb5Q.jpeg" /></figure><p>Hello everyone! I believe all of you are doing awesome in your life and improving day by day in your career. Yeah, you are! You are here because you have developed your own angular application and are curious to know how to deploy it. I am sure you can get what you needed in this blog if you follow me below.</p><h3><strong>Deployment / Hosting :</strong></h3><p>Before getting into step by step process of deployment, we must know what it means and why we need to do it.</p><p>The term ‘ <strong>Deployment</strong> ’ means “<strong>the action of bringing resources into effective action.</strong>”. This is what we are exactly doing while deploying our application. We can also define it as follows:</p><p>Deploying or Hosting is the simple process to make the application or project publically available over the internet with the help of <strong>Web servers.</strong></p><h4><strong>Web server:</strong></h4><p>A web server could be a hardware device or software or a combination of both. If it is hardware, It acts as the computer and stores the website /application data ( HTML / JavaScript / Other Assets ) with internet integration to serve the data whenever the request happens over the internet. If it is software, It may use only HTTP Servers.</p><h4><strong>Firebase :</strong></h4><p><strong><em>&amp;&amp;</em></strong> → Firebase is one of the popular platforms to host the application for even free of cost.</p><p><strong><em>&amp;&amp;</em></strong> → It is simple to use.</p><p><strong><em>&amp;&amp;</em></strong> → Clear documentation available to deploy the application with firebase.</p><p>So, simply what we are going to do is, make our angular application available on the computer which is managed by firebase for public access with the URL provided by Firebase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/372/1*PVdl0zeqaXdRuLV2zft__w.png" /></figure><h3><strong>Pre-Requests for deploying the angular application:</strong></h3><p>After completing the application as expected, we should enhance our application by implementing lazy-loading, building, etc. Building the application reduces the file sizes in order to provide a fast rendering of the application. To learn about Building angular applications visit the below Blog :</p><p><a href="https://medium.com/yavar/building-an-angular-application-f356b63622a6">Building an Angular application</a></p><p><strong>NOTE: Building is mandatory for deployment.</strong></p><h3><strong>Step-by-Step procedures to deploy the application:</strong></h3><p>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</p><p><strong>Step 1: </strong>Make sure you already have a firebase account and an angular project stored in the GitHub repository ready to deploy.</p><p><strong>Step 2: </strong>Create a new project in firebase. This is the simple three steps procedure in firebase</p><p><strong>Step 3:</strong> Install the firebase-tools in the angular-CLI using the below command:</p><pre>npm install -g firebase-tools</pre><p><strong>Step 4: Log in</strong> to the firebase using the below command : ( If you are already login, then no problem )</p><pre>firebase login</pre><p><strong>Step 5: </strong>Initialize the firebase with the following command</p><pre>firebase init</pre><p>Once you type this in the terminal it will prompt you to a list of questions. as follows:</p><blockquote><strong>1 → Are you ready to proceed?</strong></blockquote><p>→ Select <strong>YES</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yzTwkAO2dj6e-4diffbXiA.png" /></figure><blockquote><strong>2. Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to confirm your choices.?</strong></blockquote><p>→ <strong>Select according to your requirement.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hbDP9SK1SWFnGGinwwEZLQ.png" /></figure><p>I have selected the following options :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*08BpJZr2R6d--j_Ig3yfOA.png" /></figure><blockquote><strong>3. Please select an option below.</strong></blockquote><p>→ <strong>Select the existing project option if you have created the project in the firebase</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*cowjYSEBZqn0xjVVFyYHIQ.png" /></figure><blockquote><strong>4. Select a default Firebase project for this directory?</strong></blockquote><p>→ <strong>It will list the projects you have created in the firebase select yours.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*rXSkgW_hbSX6Tv1izKAmiA.png" /></figure><blockquote><strong>5. What do you want to use as your public directory? (public)</strong></blockquote><p>→ It will also provide the explanation for ( Public directory ) as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*PUQi4C6_IFkdBtLtV5uCPA.png" /></figure><p>→ According to the suggestion we must provide the dist folder name as our project will be built under the dist folder as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*YNpa3yb15uiOdNj4i2bB5g.png" /></figure><blockquote><strong>6. Configure as a single-page app (rewrite all URLs to /index.html)? (y/N)</strong></blockquote><p>→ Select <strong>YES</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*HXhb2KHoRdhWGOo5cX8EoQ.png" /></figure><blockquote>7. Set up automatic builds and deploys with GitHub? (y/N)</blockquote><p>→ Select <strong>YES </strong>If you want o configure your GitHub otherwise <strong>NO</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*Cg4x2TxGAYE0eLxQfNiNJg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lqc97kUuNkiPdt3xRl5o4A.png" /></figure><p>and the question in CLI as below:</p><blockquote>8 . For which GitHub repository would you like to set up a GitHub workflow? (format: user/repository)</blockquote><p>→ <strong>Select the repository you want.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M6bKGfsvS5OBU_EVK9fHeQ.png" /></figure><blockquote>9. Set up the workflow to run a build script before every deploy? (y/N)</blockquote><p>→ <strong>Select your option on deploy either YES or NO</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qwb9fu30W23s-tuD8PfZjg.png" /></figure><p>If you choose YES, the next question will be as follows:</p><blockquote>10. What script should be run before every deploy? (npm ci &amp;&amp; npm run build)</blockquote><p>→ <strong>Type both commands inside the braces as below</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RoK8JejnbW4z7D-PArXLEA.png" /></figure><p>We can find the new file created here in our code :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4T1yEkm9ss2FLIkv_2Kd6g.png" /></figure><blockquote>10. Set up automatic deployment to your site’s live channel when a PR is merged? (Y/n)</blockquote><p>→ select <strong>YES </strong>if you want to enable auto-merge otherwise <strong>NO</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*Zw49axUxat7v4J5sSVhAww.png" /></figure><blockquote>11. What is the name of the GitHub branch associated with your site’s live channel? (master)</blockquote><p>→ Type your branch name below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nLLcxkhhCy49d3m06J2UQw.png" /></figure><p>Once you typed the branch name, two new files will be generated as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r6dfXoE_N02BKJp8FcmYfw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YTSjnFlIiSM3QgzKOsyLMg.png" /></figure><p>After answering all questions deploy the app with the next step</p><p><strong>STEP 6:</strong> Deploy the application using the below command :</p><pre>firebase deploy</pre><p>Once you type this command, The application is deployed in firebase and the URL is generated as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gTVEvAaoNgWV4bsRSsG_yQ.png" /></figure><p><strong>STEP 7: Visit the URL provided by the CLI or copy and paste it into the browser to view our application.</strong></p><p>Initially, the screen will show only a success message.</p><ul><li>Kindly <strong>REFRESH</strong> the page to view your application. ( Otherwise )</li><li>Redo the initialization process again.</li></ul><h4>NOTE: The questions may differ according to your options. So kindly select the options for your need by carefully reading the question prompted by the CLI</h4><h4>According to my example, I was provided with the below URL:</h4><p><a href="https://firstapp-3fcac.web.app/">https://firstapp-3fcac.web.app</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oCoysSZ4VnT6ktWD7DGSDA.png" /></figure><p>As I said earlier, you are improving day by day. As proof, You have learned how to deploy the angular application in firebase calmly by reading each step. I hope for the best for you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=111d001bdfde" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/deploying-angular-application-in-firebase-111d001bdfde">Deploying angular application in firebase.</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an Angular Application in various environments using angular-CLI and server.]]></title>
            <link>https://medium.com/yavar/building-an-angular-application-in-various-environments-using-angular-cli-and-server-18f94067154b?source=rss-14c2e9c33bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/18f94067154b</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[terminal-commands]]></category>
            <category><![CDATA[angular-cli]]></category>
            <category><![CDATA[build]]></category>
            <category><![CDATA[deployment]]></category>
            <dc:creator><![CDATA[vijay s]]></dc:creator>
            <pubDate>Tue, 29 Nov 2022 04:35:51 GMT</pubDate>
            <atom:updated>2022-11-29T04:44:04.056Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog explains how to build an angular application with multiple environments within the application and server side where the angular-CLI command is unknown. This also guides you in using custom terminal commands in the angular application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*KbHcg-JyIV2zGvgCYd2pew.jpeg" /></figure><p><strong><em>……… </em></strong>Welcome to the <strong>Elevator of adventure </strong>{ Angular Application } <strong><em>………</em></strong></p><p>Hi, I am the helper on this elevator and am here to guide you to use this efficiently. As it is not an ordinary one, it has some excellent benefits that you can’t imagine. For example, could you ever think of an elevator that can even work without power? If you don’t, I can show you that in this short journey in this elevator. Let’s get into the <strong><em>Elevator of Adventure.</em></strong></p><p>One Additional piece of information, I will stop this elevator for each floor, and finally, we will reach the terrace. You can visit each floor patiently and I have a surprise for those who come to the terrace with me!</p><blockquote>Building the application is a mandatory requirement before the deployment of the application. So I explained the building process for multiple environment files step by step below :</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*wu8e-G3UKarqfBFO3PqOPg.png" /></figure><p>As with other usual elevators, our elevator will also drop you off on which floor you choose by pressing the button.</p><blockquote>If we have more than one environment in our angular application, We need to additionally mention the configuration of the environment which we need to build.</blockquote><pre>ng build --configuration=environment_name </pre><p><strong>Example:</strong></p><p>Consider that I have three environments like qa for testing , dev for development, and prod for production as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*2BCaJwB3C4SNXugwjNFlyQ.png" /></figure><p>If I want to build the development environment, I need to run the below command :</p><pre>ng build --configuration=development</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ENLvoqtDFCvrDIcRpSbOCQ.png" /></figure><p><strong>NOTE:</strong> We can find the environment_name in the angular.json file under configurations of the project build as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*A7-L5wwXuP4PIho3BUxp1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*pVdWSgXCGhOa6ipQJcuGdQ.png" /></figure><p>As I said earlier, this elevator has lots of things that can make you feel <strong><em>wow!</em></strong> Usual elevators will not move until you choose the floor. But the elevator of Adventure can drop you even if you don’t choose anything.</p><blockquote><strong>The “ ng build ” command builds the </strong>production environment<strong> as default for angular versions 12 and higher and for other versions it builds the development environment as default.</strong></blockquote><p><strong>Example:</strong></p><p>I have set up various base URLs for each environment as below. If run the ‘ng build’, the application will trigger the <strong>development environment URL</strong> as default because I am using the <strong>angular version 11.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1gZkeZovYjc_3tu6TP9kHw.png" /></figure><p>We can find the setup for “<strong>defaultConfiguration</strong>” in the angular.json file in <strong>later versions ( version 12 and above ) </strong>as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iSszWFMW9oyQ9N1qMut1mg.png" /></figure><blockquote>Here we reached the FIRST floor! Go and visit 👇</blockquote><p><a href="https://medium.com/yavar/building-an-angular-application-f356b63622a6">Building an Angular application</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*xGsMNAs2oQ-6E7MTRCX_Aw.png" /></figure><p>Oh! oh! The power is gone in the elevator</p><blockquote>Angular-CLI will not work on server</blockquote><p>But don’t worry as it is a special one, we have an alternative button. It’s time to use that.</p><blockquote>So we should use the below command to deploy an angular appliaction in the server .</blockquote><pre>npm run build</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*gSxES0IpS2dQX874RLj-Ww.png" /></figure><p>Okay, Listen! now I am going to press the alternative button which will make the elevator run without power.</p><blockquote>The application is built successfully as below:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wJI4ItCvgIJ3nLFw4YdNcQ.png" /></figure><p>Did you notice the sound when I press the button?</p><blockquote>A command is running as I run the ‘ npm run build ’ . This is defined in the scripts which is under package.json file as below :</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pubbq9Ylu7OVsEqERHelQQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*Q8zqwRQ6Bpc8C3qMD44RkA.png" /></figure><p>This is a toolbox that controls the elevator even without power.</p><blockquote>The “ scripts ” property under the package.json file supports the built-in scripts. To run the scripts we should use <strong>“ npm run “.</strong></blockquote><h4><strong>Example:</strong></h4><p>If we run “ <strong>npm run test</strong> “, the command for “<strong> test</strong> ” will be executed that is “ <strong>ng test </strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*2y06KFsBMf54dHwodf8dXA.png" /></figure><p>We can go to any floor we want even without power when we press the desired button.</p><blockquote>We can build any environment if we gave multiple, by specifying the configuration as we did for normal ng build as below:</blockquote><pre>npm run build -- --configuration environment_name OR<br>npm run build -- --c environment_name</pre><h4><strong>Example:</strong></h4><p>If I need to build the “ qa ” testing environment through the server I must specify the command as follows:</p><pre>npm run build -- --c qa</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*361lHXr39XmW_J1YAq3Zag.png" /></figure><blockquote>Here we reached the SECOND floor! Go and visit 👇</blockquote><p><a href="https://medium.com/yavar/handling-multiple-environment-files-in-angular-application-7af407c4eaa8">Handling multiple environment files in Angular Application.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*KHf3CDMObOV01FMOTVD-nQ.png" /></figure><p>Can you believe that we can change the button according to our wish? We can do it as below:</p><blockquote>We can set our custom commands with the help of the scripts property in the package.json file. So, we can now add the <strong>script that we expect to run as a value</strong> and the <strong>command is property name</strong> in the scripts property.</blockquote><h4><strong>Example: 1 → Defining own word for the “ ls ” command in scripts</strong></h4><p>I believe Harry Potter fans can relate to this below command.</p><pre>accio  ( example only )</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bTh_IVCg-Goksn3qQ3mMTg.png" /></figure><p>Funs apart, this is useful when we use this in building various environments. We can specify our own commands as below in scripts as below:</p><h4>Example: 2 → Defining the custom commands for server-side build :</h4><p>If we want to build the application on the server side with easier terminal commands, we can set that like the below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-0gZmcW4w6TXoytPOWbZaQ.png" /></figure><blockquote>Here we reached the THIRD floor! Go and visit 👇</blockquote><p><a href="https://medium.com/yavar/angular-project-important-files-folders-2e375cb9822b">Angular project-Important files &amp; folders.</a></p><p>Finally, we reached the terrace which is loved by all of us. So, as I already said that I have a surprise for those who traveled with me to this terrace. I believe everyone will love this too as we love the terrace.</p><p>Here I give you the <strong>Elevator of adventure </strong>to your home 👇 . Don’t ignore sharing your opinion on this journey. Have an adventurous journey 🥳.</p><p><a href="https://medium.com/yavar/angular-project-setup-a4cc561ece33">Angular project setup</a></p><p><strong><em>→→→→→→→→→→</em></strong> <strong>Elevate your skills to the extreme</strong> <strong><em>←←←←←←←←←←</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18f94067154b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/building-an-angular-application-in-various-environments-using-angular-cli-and-server-18f94067154b">Building an Angular Application in various environments using angular-CLI and server.</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an Angular application]]></title>
            <link>https://medium.com/yavar/building-an-angular-application-f356b63622a6?source=rss-14c2e9c33bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/f356b63622a6</guid>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[ng-build]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[angular-buil]]></category>
            <category><![CDATA[how-to-build-a-website]]></category>
            <dc:creator><![CDATA[vijay s]]></dc:creator>
            <pubDate>Sat, 29 Oct 2022 12:35:55 GMT</pubDate>
            <atom:updated>2022-10-31T02:24:53.543Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>This blog explains the necessity and the procedures involved in building an angular Application in a detailed view with angular CLI and serving it.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j7ANJ8-PLtOO2fs9CMAudg.jpeg" /></figure><blockquote><strong>“ Hi new-colleague! I welcome you to our courier office. Our courier service is different from others. Because In our office we only deliver one Unique parcel</strong> .”</blockquote><h4>{ <strong>An Angular Application</strong> }.</h4><blockquote><strong>“ You are appointed in the packing department. As you are new to this job, I am going to tell you how to pack this parcel</strong> before its delivery “</blockquote><h4>{<strong> Build an angular Application before Deployment</strong> }</h4><h3><strong>Reason for building an Angular Application before deployment:</strong></h3><blockquote><strong>‘’ Every parcel needs to be packed before its delivery. Likewise, our special parcel also gets packed for the below reasons: ‘’</strong></blockquote><ul><li><strong>It Bundles the application with optimized codes and reduces the file sizes to increase the performance of the application after deployment.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NHgGiz5-u9ibRBJFTFvbgA.png" /></figure><ul><li><strong>It compiles the typescript code to javascript. The Converted javascript codes handle the DOM content and logic in the browser to display.</strong></li></ul><h3><strong>STEP 1: Verify before Building the application :</strong></h3><blockquote>First of all, you need to check whether the parcel is ready to pack or not.</blockquote><h4>{ <strong>Check if the Angular Application is completed successfully and ready to deploy.</strong> }</h4><h3><strong>STEP 2: Build the application with ng build terminal command :</strong></h3><blockquote><strong>If the parcel is ready, take that parcel and fix it in the packing machine and press the ‘ pack ’ button.</strong></blockquote><h4><strong>{ Run the below command in the terminal }</strong></h4><pre>ng build</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DC88nJ0GkrbtYPl3v9-h-A.png" /><figcaption>The angular application <strong>before the ng-build</strong> command</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OWvgBTbHVrOxygdW36X__w.png" /><figcaption>The angular application <strong>After the ng-build</strong> command</figcaption></figure><h3><strong>STEP 3: Verify the Dist Folder:</strong></h3><blockquote><strong>Now the packing machine will produce a recipt. This receipt is proof that the special parcel is packed well.</strong></blockquote><h4>{ <strong>Once the Angular Application is built successfully the new Dist folder will be generated in the application itself as below</strong> }</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*AAeHo0TslINpiLhwIdnC9w.png" /><figcaption>Newly Generated dist folder after ng build command in terminal — Angular application</figcaption></figure><h3><strong>About Dist Folder:</strong></h3><blockquote>The Receipt has some details about the special parcel as below:</blockquote><p><strong>The Dist folder contains the other folder in the application name. That folder consists of several files like assets,index.html and some javascript files</strong></p><ul><li>index.html<strong> → It acts as the normal index.html in the application with newly generated javascript codes.</strong></li></ul><p><em>Index.html in </em><strong><em>src </em></strong><em>folder:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vt7lsknR6JINMaP7HvbHrA.png" /></figure><p><em>Index.html in </em><strong><em>Dist </em></strong><em>folder:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1AjnYDyzS2L4EhIt4y4CMg.png" /></figure><ul><li><strong>assets Folder → It also takes a copy of existing assets.</strong></li><li><strong>Javascript Files → These files are converted versions of our existing typescript files to javascript.</strong></li></ul><h3><strong>STEP 4: Serve the Built application with the dist folder’s index.html :</strong></h3><blockquote><strong>Once the parcel is produced the receipt, You must take the receipt and do receipt validation to verify the parcel is not damaged after packing in the recipt validator .</strong></blockquote><h4>{ <strong>Run the application with the new index.html to see whether the application was built successfully </strong>}</h4><p><strong>Step 4.1: Open the separate instance of the VS code for the built application in Dist Folder:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vkl8QOiq6XoC_J9GyK2FHw.png" /></figure><p><strong>NOTE</strong>: Open a separate instance for this DIST Folder, don’t do this in the existing one.</p><p><strong>Step 4.2: Run the index.html file with ‘ Vs code’s live serve ’.</strong></p><p>That means If you right-click in the index.html, there will be an Open with Live Serve option or Use Go Live ( Extension of VS Code )</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*L5CQ7RCuGd-8fDIKX2qXww.png" /></figure><p><strong>Step 4.3: Verify that the application runs as expected in the browser as below :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*BAV6_lEpCFDv9mdmWGcJuA.png" /></figure><h3><strong>Step 5: Rebuild if any error occurs while building the Application:</strong></h3><blockquote>If you find any problems While Receipt Validation, Kindly clear those problems according to instruction given by the reciept validator.</blockquote><h4>{<strong> If you encounter any errors while building the application ( Mostly the errors will be optimization errors ), clear them with the help of error messages</strong> }</h4><blockquote><strong>Okay, that’s it! my new colleague. I give you the parcel. You can pack it as I instructed.</strong></blockquote><p><a href="https://medium.com/yavar/angular-project-setup-a4cc561ece33">Angular project setup</a></p><h4><strong>**** Even packing will excite you when you do it with Eager ****</strong></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f356b63622a6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/building-an-angular-application-f356b63622a6">Building an Angular application</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Handling multiple environment files in Angular Application.]]></title>
            <link>https://medium.com/yavar/handling-multiple-environment-files-in-angular-application-7af407c4eaa8?source=rss-14c2e9c33bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/7af407c4eaa8</guid>
            <category><![CDATA[build]]></category>
            <category><![CDATA[angular-cli]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[multiple-environment]]></category>
            <dc:creator><![CDATA[vijay s]]></dc:creator>
            <pubDate>Sat, 08 Oct 2022 12:17:57 GMT</pubDate>
            <atom:updated>2022-10-10T05:24:04.885Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>This blog guides you in handling various environment files in an angular application and building each of them seperatedly with terminal command .</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NOXoaRdw1fVuRpbDhq_-Yw.png" /></figure><blockquote><strong><em>Hey </em></strong><em>Baby </em>👶<em>! </em><strong><em>Sorry Sorry! Because You may be in your teenage period </em></strong>👦<strong><em> or middle-age </em></strong>🙎‍♀️<strong><em> or senior years </em></strong>👴<strong><em>. One thing is sure, if the universe permits, you shall definitely meet all the above-mentioned stages of human life. But, you can’t go to the past or to the future.</em></strong></blockquote><blockquote><strong><em>“ How will it be if we can go back and forth in our life ? ”. It is still a curious question and many people researching it. I am dam sure that I am not one among them, but I want to share something peculiar related to that.</em></strong></blockquote><p><em>One day, I bought a TOY</em> <strong>{ An angular application }. </strong><em>That is a Baby doll toy </em>👶 <em>and it can get grown old </em>👴 <em>when I say the password</em> “ <strong>ng build</strong> ” <strong>{ The environment is changed automatically from development to production when the application gets built }.</strong></p><p><em>I want to show you the backside of my TOY which doing this transformation from baby to an old stage </em><strong>{ angular.json executes the replacement which is configured under build section }.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*ISVO_gSE-p8KW9mrfbMJXQ.png" /><figcaption>angular.json file</figcaption></figure><p><em>This TOY usually come up with the two default stages like baby</em> { <strong>development environment</strong> } and old { <strong>Production environment</strong> }.</p><p><em>The special thing about this TOY is, I can transform this into various stages like teenage </em>👧 <em>, middle age </em>👨 <em>, and so on according to my wish except for the default two stages. </em>{ <strong>The Developer can have multiple environment files for various stages of the application like testing, bug-fixing and so on that is according to him</strong> }</p><p><em>Now I am going to show how to transform this TOY to a teenage period </em>👦<em>step by step</em> {<strong> Adding a new environment to existing angular application </strong>}.</p><p><strong>* 1:</strong><em> First, I opened the below part of my TOY and labeled it </em>🏷️ <em>with a nice name</em> { O<strong>pen environments folder and create a new file with a meaningful name</strong> }</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/348/1*tWBcVPKDbnYlNb6c2r9AkQ.png" /><figcaption>Added a new environemt.meaningful_name.ts file into the environments folder</figcaption></figure><p><strong>* 2:</strong><em> After naming it, I specified the appearance of my TOY’s teenage stage like the color, hairstyle, dress and etc in a small memory chip</em> { <strong>Inside the newly created file, specify the necessary properties of the environment object that you want }</strong></p><p><strong>“ Example: you can have another </strong><strong>apiurl for this new environment. Set the production value to </strong><strong>true , because it must be converted to true while building ”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*XM-nDE-w9f2ZrABMLgIu8g.png" /><figcaption>various environment files with specific properties and values separately</figcaption></figure><p><strong>*<em> 3:</em></strong><em> Now the memory chip is ready with my own teenage style of TOY and I want to insert it in the correct part of this TOY</em> { <strong>We need to configure this new environment in angular.json file</strong> }</p><ul><li><em>@1 : I Opened the backside</em> {<strong> Open angular.json</strong> }</li><li><em>@2 : I can see the Chipholder </em>{ <strong>configuration property</strong> } <em>which has two default</em> <em>chips</em> { <strong>configuration property has production and development as default as below</strong> }</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*Kj7s8SNn-M3XkmkNtdTJyA.png" /><figcaption>configuration property in angular.json file</figcaption></figure><ul><li><em>@3 : I inserted my new chip inside the chip holder</em> { <strong>Copy the existing production property with all its key-value pairs and create a new property with a new meaningful name. Paste the copied content in the new property</strong> }</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*89anmO78zG7tkE-s3e5-xw.png" /><figcaption>configuration in angular.json which is configured to build a new environment file</figcaption></figure><ul><li><em>@4 : Finally, I did an important thing, I connected the source cable </em>🔌<em>to the new chip inserted</em> { <strong>Change the file name under the </strong><strong>fileReplacements property with the new environment file that you created</strong> }</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*PsHUFSyXnN1nDU1J9nddcQ.png" /><figcaption>FIle-replacement in configuration</figcaption></figure><p>*<em> My TOY with a teenage period is ready and I can call it with the password</em> 🔑</p><p>ng build --configuration qa OR ng build --configuration=qa</p><p>{ <strong>Build the application with added configuration name</strong> }</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3SK6_sdUJapMHh4_GlZ3NA.png" /><figcaption>Build the application with a new environment configuration</figcaption></figure><p>* Wow, here I got the teenage stage TOY</p><p>{ <strong>The qa environment is built with the baseUrl, we provided in </strong><strong>environment.qa.ts }</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*-hqGSZGlMd3R7CqubC6xvA.png" /><figcaption>The application is built with the apiUrl in the new environment</figcaption></figure><blockquote><strong><em>I believe that this peculiar TOY amazed you! Yeah! It will amaze you as it can do the magic that you can only dream of . You may get jealous of me for having such a TOY like this. But I am going to be generous, Yeah! I share the address below of the shop where I found this TOY.</em></strong></blockquote><p><a href="https://medium.com/yavar/angular-project-setup-a4cc561ece33">Angular project setup</a></p><h4>. . .<strong> ~ Peculiar things will not always fail to steal our attention ~ . . .</strong></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7af407c4eaa8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/handling-multiple-environment-files-in-angular-application-7af407c4eaa8">Handling multiple environment files in Angular Application.</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding Bootstrap to angular application.]]></title>
            <link>https://medium.com/yavar/adding-bootstrap-to-angular-application-e449cd6bdce0?source=rss-14c2e9c33bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/e449cd6bdce0</guid>
            <category><![CDATA[angular-bootstrap]]></category>
            <category><![CDATA[angular-cli]]></category>
            <category><![CDATA[npm-i-bootstrap]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[bootstrap]]></category>
            <dc:creator><![CDATA[vijay s]]></dc:creator>
            <pubDate>Sat, 03 Sep 2022 14:15:53 GMT</pubDate>
            <atom:updated>2022-09-07T03:31:49.595Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong><em>This Blog explains the detailed process of downloading Bootstrap to an Angular Application through angular/CLI that supports Bootstrap classes in our Angular Application.</em></strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fvah0rohA5-qm1jFZ9U96g.png" /></figure><h4>Hey happy Stranger!</h4><p>You:😟</p><h4>Okay, I also don’t want to be a stranger to you. So let’s try to build a friendship before leaving this marriage hall</h4><p>{ <strong><em>Angular Application</em></strong><em> </em>}</p><h4>Hey Mr/Mrs. Stranger! , Why the couple is not looking good? Whether they applied make-up are not?</h4><p>{ <strong><em>Bootstrap class not applied to the elements in Angular Application</em></strong> }</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5t_PATY1NdQsIh6k_sOYHg.png" /><figcaption>Bootstrap class is not applied even if they have been used in elements</figcaption></figure><p>You:👎🏻</p><p><strong>Why? Whether the make-up artist { </strong>Bootstrap<strong> } came or not?</strong></p><p>You:👎🏻</p><h4><strong>Where is he Now?</strong></h4><p>You: ✈️</p><h4><strong>Oh! He is at the Airport Check-in counter?</strong></h4><p>You: 👍</p><h4><strong>Sorry to ask this silly question, but what needs to be shown at the Airport Check-in counter?</strong></h4><p><strong>{ What do we want to do to install bootstrap in angular application }</strong></p><p>You: 👇</p><pre>npm view bootstrap</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fTcpsIdk58OUbZhrmoNtvQ.png" /></figure><h4>What Next?</h4><p>You: 👇</p><pre>npm install bootstrap@latest --save</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vdzAsIAanPbDp1c7iPzn0A.png" /></figure><h4><strong>Then?</strong></h4><p>You: 👇</p><p>npm install @popperjs/core</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qJDH4H6xB9iDB7SQBIjB7g.png" /></figure><h4><strong>Who is the</strong> Popperjs ?</h4><p>You: 💁🏻‍♀️</p><h4><strong>Yeah! Without Assistan</strong>t &#39;<strong>popperjs </strong>💁🏻‍♀️<strong>&#39; </strong>it will be very difficult for him to manage everything</h4><p><strong>{ To handle some classes that depend on javascript functions like dropdown, toggles, etc …}</strong></p><p>You: 👍</p><h4><strong>whether they will reach on time?</strong></h4><p>You:👍</p><p>…. ⏳ …</p><p>You:🛄</p><h4><strong>What? When they have reached? Where are they now?</strong></h4><p>You: 👇</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*zkO0IodjqfEBSMbU5A1rxA.png" /><figcaption>bootstrap. min.css fie inside</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*xHBdC5oCf8SffNYBF2MFqA.png" /><figcaption>Bootstrap. min.js</figcaption></figure><h4><strong>Okay. </strong><strong>Bootstrap with his baggage </strong>🛄<strong>is here. Where is his Assistant </strong><strong>popper ? </strong>💁🏻‍♀️</h4><p>You: 👇</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*UJYIJS4oi-pYu5PEiBMm8A.png" /><figcaption>Popper. min.js</figcaption></figure><h4><strong>Hey, man! Go and get them to the groom and Bride’s Room. Let them start their duty. I think the time is getting out.</strong></h4><p>{<strong> Insert the above files in the Angular.json</strong> }</p><p>You: 👍</p><h4><strong>Have you done it?</strong></h4><p>You: 👍 , 👇</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LskQls3R4hSdHtv2JmdmCQ.png" /><figcaption>Update angular.json</figcaption></figure><h4><strong>Great man. Whether they started to make up the couple?</strong></h4><p>You: ❌</p><h4><strong>Why?</strong></h4><p>You: 😋​</p><h4><strong>Yeah! They could be hungry because they have traveled a lot. First Serve them food.</strong></h4><p>{<strong> Rerun the Application again after installing the bootstrap packages Otherwise it will not work </strong>}</p><p>You: 👍 , 🍽️ , 👇</p><pre>ng serve</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KglokcuUcmrPObARQSP8bw.png" /><figcaption>ng serve command</figcaption></figure><h4><strong>Great. Let’s wait until they finish their work.</strong></h4><p>You: 👍</p><p><strong>...</strong> ⏳ <strong>…</strong></p><h4><strong>See now, They look wonderful.</strong></h4><p><strong>You</strong>: 🥳 … 👰🏽​🤵​</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*seubHPYTNk93D6hNfK7ryQ.png" /><figcaption>Bootstrap installed with version 5.2.0 ( latest )</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VLxq3hrdxS1gJhfrikDR1g.png" /><figcaption>A simple Angular page with some bootstrap classes like navbar, card, dropdown</figcaption></figure><h4><strong>Hey, thanks for your company Stranger. One last request. Anyone has thrown the invitation below. Please take it.</strong></h4><p><a href="https://medium.com/yavar/angular-project-setup-a4cc561ece33">Angular project setup</a></p><blockquote><em>“ Every Friend of yours is a stranger before you share anything with them ”</em></blockquote><p><em>I have shared what I know and waiting for you to share the review on it …</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e449cd6bdce0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/adding-bootstrap-to-angular-application-e449cd6bdce0">Adding Bootstrap to angular application.</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Workflow of Angular]]></title>
            <link>https://medium.com/yavar/workflow-of-angular-56750dfe11cd?source=rss-14c2e9c33bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/56750dfe11cd</guid>
            <category><![CDATA[angular-behind-the-scenes]]></category>
            <category><![CDATA[how-angular-gets-loaded]]></category>
            <category><![CDATA[angular-work-flow]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[vijay s]]></dc:creator>
            <pubDate>Sat, 20 Aug 2022 07:11:55 GMT</pubDate>
            <atom:updated>2022-09-01T12:29:09.958Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This blog explains the flow that happens to display the angular application in the browser which cannot be seen but can be aware of, in order to get a better understanding of the angular application and to improve debugging.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xGEPgjG9KWLGzH6nqKy_EA.jpeg" /></figure><blockquote>Hi Partner ! Yeah ! i need you as my partner for a while . Don’t worry ! you don’t want to invest money because we are not going to do any business . But , you will get treasure . Confusing right ?</blockquote><blockquote>Let me explain …</blockquote><blockquote>No one beleived me when i said it . But i hope you will . I have got a treasure in my Home</blockquote><h3>{ <strong>An Angular Application running in browser</strong> }</h3><blockquote>with the help of my friend who shared me his blog to get it . You can also get it of your own by visiting this blog below :</blockquote><p><a href="https://medium.com/yavar/angular-project-setup-a4cc561ece33">Angular project setup</a></p><blockquote>I think you have also got your own treasure . right ?</blockquote><blockquote>oh Sorry ! I haven’t revealed that why i needed a partner . That’s a different story .</blockquote><blockquote>One Fine day , When i was thinking about from where the trasure come from ? ,</blockquote><h3>{ Consider, how an angular application starts running and is visible in the browser. },</h3><blockquote>One magical voice said “Wanna know ? Let’s play Treasure Hunt . You will find your answer at the end of the game . ”</blockquote><h3><strong>{ Consider, that we can get a better understanding of angular application flow to work with ease }.</strong></h3><blockquote>Believe me it happened . That’s why i need a help from a genius as you . Don’t get shy . I can see the blushes on your cheeks from here . Ha … Ha… Ha…</blockquote><blockquote>Let’s trace the clues one by one before your blush goes away .</blockquote><blockquote>The first clue that the voice said is ,</blockquote><blockquote>“ 1 . angular.json — main ”</blockquote><blockquote>So , our first clue is <strong>angular.json -main :</strong></blockquote><p><strong>1.angular.json -main :</strong></p><p>Hey, I have found it. It is the file that consists of all the configurations and references of the application.<strong> The build sections denote that the builder should start its execution from here</strong>. According to the build section and our clue, the main is referred to main.ts file which is under src.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SvUWP6H5R2nSaUHaCi4uLA.png" /></figure><blockquote>So , our next clue is <strong>main.ts .</strong></blockquote><p><strong>2 . main.ts :</strong></p><p>We can partition the main.ts file into two sections as below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nLgGY8oprMhttRFToCmtwg.png" /></figure><p><strong>#1 environment section :</strong></p><p>In this environment section, we only have a simple if condition which executes one method called <strong>enableProdMode()</strong>. The condition statement is the <strong>environment. production</strong> where an <strong>environment</strong> is an object which has <strong>production</strong> as a property that should have a boolean value ( <strong>true or false</strong> ) to decide whether to execute the enableProdMode() or not ? To find the value (<strong>true </strong>or<strong> false)</strong>, we need to refer<strong> environment.ts file from the environments folder</strong> because the environment is imported from there only.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*Jaybm_9Drm3kIOlWbK8tPw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KqIQTBTi6osQdJwCw7WMMw.png" /></figure><p>Here, the production value is <strong>false. </strong>So, <strong>enableProdMode()</strong> is not get executed as the condition failed. To verify that, I have given a console message in the else block as below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sBjnWCisPVVyJj-B9YTdDA.png" /></figure><p><strong>Result :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*CbLMuzm1xkXWwIbL9Gszlw.png" /></figure><p>Promisingly , <strong>enableProdMode() is not working</strong> . Usually, we will throw out anything which is not working from our house. is it? ( Skipping now but we will discuss it in another blog ) .</p><p><strong>#2 Platformbrowser section :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*0ZbSI4l_VqMcgdfbjRTI5g.png" /><figcaption>b</figcaption></figure><p><strong><em>##</em></strong> <strong>platformBrowserDynamic() :</strong></p><p>In platformbrowser section ,<strong> platformBrowserDynamic()</strong> is a method that returns a <strong>platformRef</strong> imported form platformBrowserDynamic folder’s index.d.ts file .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zq_07E0KwP7wLanrPl4maQ.png" /></figure><p>The angular team has described the platform as below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vnsHD3533mTIvR3vBZJhSA.png" /></figure><p>So, platformbrowserDynamic() is responsible for creating a platform (place)to render our application in the browser.</p><p><strong>## bootstrapModule(AppModule) :</strong></p><p>The bootstrap module usually generates a module decorator which has browserModule as imports and we can pass our own module as an argument . Then our Module will get loaded and executed.</p><pre> ### Simple Example</pre><pre> ```typescript</pre><pre> @NgModule({</pre><pre>   imports: [BrowserModule]</pre><pre> })</pre><pre> class MyModule {}</pre><pre> let moduleRef = platformBrowser().bootstrapModule(MyModule);</pre><p>In our bootstrapModule in main.ts file, we have provided <strong>AppModule</strong> as an argument that is imported from <strong>app.module.ts</strong> . Then we have got our next clue.</p><blockquote>So , our next clue is <strong>App.module.ts :</strong></blockquote><p><strong>3. App.module.ts :</strong></p><p>The AppModule is bootstrapping the <strong>AppComponent</strong> which is imported from app.component.ts file. So the AppComponent gets loaded next. We can modify the project’s bootstrap component according to our needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*oqGTXkYWHtixLf4T1QzFxA.png" /></figure><blockquote>So , our next clue is <strong>app.component.ts .</strong></blockquote><p><strong>4. app.component.ts :</strong></p><p>In app.component.ts file , the Component decorator has three important properties with values :</p><ul><li><strong>selector</strong> → It has a file as the value that is responsible to utilize this component in another template file as an <strong>element</strong>.</li><li><strong>templaturl </strong>→ It has an <strong>HTML file</strong> as a value that displays the screen.</li><li><strong>styleUrls</strong> → It has a <strong>CSS file</strong> as a value that is used to style the component’s HTML.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*sI_P01UqDjzkbZVgkjXc1Q.png" /></figure><blockquote>So , our next clue is <strong>app.component.html .</strong></blockquote><p><strong>5. app.component.html :</strong></p><p>As we found that app.component.html is responsible for the screen we see in our browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*FFjV2TgaznCppCn9iGJJPw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IOH1z5QjDN4s5CGo5GhRbw.png" /></figure><p>In our HTML, we do not use proper standard code like the below which is very basic to obtain a webpage in a browser.</p><pre>&lt;html&gt;</pre><pre>...</pre><pre>&lt;/html&gt;</pre><p>Where have they gone? So if we inspect the page, we should see the exact HTML code we provided in app.component.html. Am I right? Let’s check.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*9obQQPcSR-Z9NqzcJWlXAg.png" /></figure><p>Now, we can get clarification because Here we got the proper structure of HTML and the <strong>&lt;app-root&gt;&lt;/app-root&gt; </strong>selector is used as an element to get the app component.</p><p>The javascript files available below the root element {runtime.js, polyfile.js, … etc } are responsible to make our application a single page and they are handled by the browser itself. But, the Html code should be available in our application itself.</p><blockquote>Hey partner i heared your voice . you are saying</blockquote><blockquote>“ index.html ” right ? Let’s hope for the best .</blockquote><blockquote>So , Our next clue is <strong>index.html .</strong></blockquote><p><strong>6. index.html :</strong></p><p>Yeah! it is available in our src folder. This is the main placeholder of our whole application. But we access dynamic modules and components by attaching them with our AppModule. But, however, the browser only knows the single index.html other modules are handled by scripts that are available in browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*XdyxT4f-zvq5zq9--miMPw.png" /></figure><blockquote>Finally , we have won the game . As the mysterious voice said , i have found my answer .</blockquote><h3>{ consider understanding on application flow happens behind the scenes}</h3><blockquote>Partner , thank you for helping me in this game . Without you it is not possible . You have proved that you are a genius . I just wanna offer you my treasure too .</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/232/1*coC1ND3WBu_-QjG7IrLRkw.jpeg" /></figure><p><strong>……………. Always imagine yourself wearing this crown! ………………</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56750dfe11cd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/workflow-of-angular-56750dfe11cd">Workflow of Angular</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular project-Important files & folders.]]></title>
            <link>https://medium.com/yavar/angular-project-important-files-folders-2e375cb9822b?source=rss-14c2e9c33bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e375cb9822b</guid>
            <category><![CDATA[angular-application-files]]></category>
            <category><![CDATA[angular-project]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[files-in-angular]]></category>
            <dc:creator><![CDATA[vijay s]]></dc:creator>
            <pubDate>Wed, 20 Jul 2022 03:56:03 GMT</pubDate>
            <atom:updated>2022-07-21T05:18:01.910Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Introduction to important files in a new Angular Project…</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*jgLUOw2qUt1VxaKOVSdgkA.jpeg" /></figure><blockquote>Hi kids ! Sounds fun right ? Let’s continue the fun by being good kids for some more time . Why Because we invited a special guest ( New angular project ) to our Home ( Our system ) . So we need to make good impression with them according to popular saying called “ First impression is the best impression ” . Those who don’t aware of the guest (Setting up a new angular Project), kindly visit this blog below.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/64/0*7sx-0ENFYUf4loij.png" /></figure><p><a href="https://medium.com/yavar/angular-project-setup-a4cc561ece33">Angular project setup</a></p><blockquote>Others behave good until the guest leaves . if you do so , i have surprise for you !</blockquote><p>In this blog we are going to aware of some basic information that must be known by everyone to understand an angular application . A newly downloaded angular project will contain certain folders and files by default with some working process.We shall see them one by one .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6JMlSctUHPIHnrueXyOcZQ.png" /><figcaption>Files in Angular-Project</figcaption></figure><p><strong>1 ) Package.json file :</strong></p><p>This package.json file contains every dependencies and dev-dependencies of our project. It declares the project to be in EcmaScript Module format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DFUY7eLvfIrg7KJzHpDyMA.png" /><figcaption>Package.json file</figcaption></figure><p><strong>2 ) node_modules folder :</strong></p><p>node_modules folder consists of many sub-folders and lot of files within it . These files having the detailed description and functionalities of the package.json file’s dependencies.</p><p><strong>3 ) src folder :</strong></p><p>src folder contains the bunch of our configurations and app folder.</p><p><strong>4 ) app folder :</strong></p><p>app folder is one of the main feature which contains five important files as below :</p><ul><li><strong>app.component.html</strong> → It is the control of template of application . we must include other manually generated components here to view them.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aGxSBwcvZDiFhx_nutX2AQ.png" /><figcaption>app.component.html</figcaption></figure><ul><li><strong>app.component.css / app.component.scss </strong>→It used to style the template.</li><li><strong>app.component.ts </strong>→It helps to interact with html for delivering data.It is most important file in the application.It contains the <strong>app-root selector</strong> which is part of index.html.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2LZNBVBFT48NJeFPugxbWg.png" /><figcaption>app.component.ts</figcaption></figure><ul><li><strong>app.component.specs.ts</strong> → It is used for testing ( Need not to worry about it )</li></ul><p><strong>5 ) app.module.ts :</strong></p><p>This is one of the most important file in the application which controls the modules other components and modules in the application. Every components and modules should be known to to this application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YpyDG1JGm_rnGLQEaMWvQQ.png" /><figcaption>app.module.ts</figcaption></figure><p><strong>6 ) index.html:</strong></p><p>It is the root file of our application . It is the one which generates the application first and visible in the console. It also holds the root which is used in app.component.ts file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KuYXHTwYq81uvRpjWvpqsw.png" /><figcaption>index.html</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zGKWdSpMc156ezK1nxU4yw.png" /><figcaption>root ( index.html )</figcaption></figure><blockquote>Hey kids thanks for your patience and behaved good in-front of guest. Here our guest has left our home . They requested me to convey a message that they values your childish heart and wants to know your understanding on them . I hope you understood well . Get your gift and go !</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*G_I1gMqKRfnP4jXeQCNjWA.jpeg" /></figure><p><strong>(((((((((((((((((((((</strong> <em>Always be a child &amp; learn by mistakes </em><strong>)))))))))))))))))))</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e375cb9822b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/angular-project-important-files-folders-2e375cb9822b">Angular project-Important files &amp; folders.</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>