<?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 Nixon Augustine on Medium]]></title>
        <description><![CDATA[Stories by Nixon Augustine on Medium]]></description>
        <link>https://medium.com/@nixonaugustine5?source=rss-3fa4ff9614cb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*S67dcxV1eMndBTK1XzT_Lw.jpeg</url>
            <title>Stories by Nixon Augustine on Medium</title>
            <link>https://medium.com/@nixonaugustine5?source=rss-3fa4ff9614cb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 10:06:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nixonaugustine5/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[Spot Instances with Karpenter: Cutting Your Kubernetes Bill by Up to 40% (Without Losing Sleep)]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-snippet">Part 3: Ravi goes after the biggest discount AWS offers, and learns exactly where the traps are. Read Part 1 and Part 2 from here.</p><p class="medium-feed-link"><a href="https://medium.com/@nixonaugustine5/spot-instances-with-karpenter-cutting-your-kubernetes-bill-by-up-to-40-without-losing-sleep-97bb2b1c2e35?source=rss-3fa4ff9614cb------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@nixonaugustine5/spot-instances-with-karpenter-cutting-your-kubernetes-bill-by-up-to-40-without-losing-sleep-97bb2b1c2e35?source=rss-3fa4ff9614cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/97bb2b1c2e35</guid>
            <category><![CDATA[scaling-with-karpenter]]></category>
            <category><![CDATA[karpenter]]></category>
            <category><![CDATA[aws-cost-savings]]></category>
            <category><![CDATA[cost-savings]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Nixon Augustine]]></dc:creator>
            <pubDate>Wed, 30 Sep 2026 04:12:03 GMT</pubDate>
            <atom:updated>2026-09-30T04:13:22.503Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Implementing Karpenter on EKS: From Whiteboard to a Working Cluster]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-snippet">Part 2: Ravi rolls up his sleeves, and finds out what the brochure doesn&#x2019;t tell you. Read Part 1 from here.</p><p class="medium-feed-link"><a href="https://medium.com/@nixonaugustine5/implementing-karpenter-on-eks-from-whiteboard-to-a-working-cluster-c06f7fa946e1?source=rss-3fa4ff9614cb------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@nixonaugustine5/implementing-karpenter-on-eks-from-whiteboard-to-a-working-cluster-c06f7fa946e1?source=rss-3fa4ff9614cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/c06f7fa946e1</guid>
            <category><![CDATA[kubernetes-cost-saving]]></category>
            <category><![CDATA[kubernetes-cluster]]></category>
            <category><![CDATA[scaling]]></category>
            <category><![CDATA[cost-savings]]></category>
            <category><![CDATA[karpenter]]></category>
            <dc:creator><![CDATA[Nixon Augustine]]></dc:creator>
            <pubDate>Wed, 30 Sep 2026 03:57:04 GMT</pubDate>
            <atom:updated>2026-09-30T04:10:48.587Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Karpenter on Kubernetes: Smarter, Cheaper Autoscaling on AWS]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-snippet">The story of a half-empty cluster, a surprise cloud bill, and the tool that fixed both.</p><p class="medium-feed-link"><a href="https://medium.com/@nixonaugustine5/karpenter-on-kubernetes-smarter-cheaper-autoscaling-on-aws-eb6805e320d1?source=rss-3fa4ff9614cb------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@nixonaugustine5/karpenter-on-kubernetes-smarter-cheaper-autoscaling-on-aws-eb6805e320d1?source=rss-3fa4ff9614cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb6805e320d1</guid>
            <category><![CDATA[karpenter]]></category>
            <category><![CDATA[scaling-with-karpenter]]></category>
            <category><![CDATA[kubernetes-cost-saving]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[kubernetes-cost]]></category>
            <dc:creator><![CDATA[Nixon Augustine]]></dc:creator>
            <pubDate>Wed, 30 Sep 2026 02:50:46 GMT</pubDate>
            <atom:updated>2026-09-30T04:18:00.739Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Kubernetes — Should I use it ?]]></title>
            <link>https://medium.com/@nixonaugustine5/kubernetes-should-i-use-it-75340843a54b?source=rss-3fa4ff9614cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/75340843a54b</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[aws-eks]]></category>
            <dc:creator><![CDATA[Nixon Augustine]]></dc:creator>
            <pubDate>Tue, 13 May 2025 04:47:07 GMT</pubDate>
            <atom:updated>2025-05-30T04:17:20.346Z</atom:updated>
            <content:encoded><![CDATA[<h3>Kubernetes — Should we use it ?</h3><p>There has been a lot of buzz nowadays about Kubernetes and its implementation. Engineers are really unsure if they should use Kubernetes and what is the factor that needs to be considered before deploying an Application into Kubernetes.</p><p><strong><em>Long Story Short — Not all Application is suitable for Kubernetes. Make your decision wisely.</em></strong></p><h3>What is Kubernetes ?</h3><p>Kubernetes is an <strong>open-source container orchestration </strong>platform used to <strong>automate</strong> the <strong>deployment</strong>, <strong>scaling</strong>, and <strong>management of containerized applications.</strong></p><p>Lets explore Key terms in the definition:</p><p><strong>Open-source </strong>— its code is readily available — which may be modified, edited and used.</p><p><strong>Container </strong>— Packaging an application along with its runtime so that i can run in any environment uniformly.</p><p><strong>Orchestration</strong> — Manage the deployment, scaling and everything so that it can work smoothly.</p><p><strong>Automate </strong>— Automatically manage features like<br>* <strong>Scaling</strong> — increasing/decrease the computing capabilities<br>* <strong>Deployment</strong> — putting and running a code on a server/server environment<br>* <strong>Management</strong> — ensure everything is working fine .</p><p>So in simple words — Kubernetes is a platform that can automate deploying your code/application (container) to an environment which is managed by it, and can scale up or down the computing capability based on need.</p><p>WOW !!! That’s great isnt it. Sounds like something that can do the job of an entire Server/Devops Team. Wait .. don’t be too quick to fire them .</p><p>There is a catch !!! Its not as simple as the definition. There are few pre-requisites and skill that are required to get things into action.</p><h3>Where do WE START?</h3><p>The first and foremost thing to be able to implement Kubernetes is to ensure that your application is <strong>STATELESS</strong>. If it’s stateless, we are good to go-ahead and <strong>DOCKERIZE</strong> the application.</p><h3>What is STATELESS?</h3><blockquote><strong><em>A stateless system, application, or protocol doesn’t maintain information about past interactions. Each request is treated as if it’s the first, and no context or state from previous requests is carried forward. This contrasts with stateful systems, which do keep track of interactions and maintain state.</em></strong></blockquote><p>In simple terms, a stateless application will not store any new data locally during its lifetime..</p><p>For example, lets say your application stores information in the local file system. Hence, if you delete the server/VM which the application is running on you would lose the data. So this becomes a STATEFUL application.</p><p>On the contrary, if your application stores data in the cloud like a S3 or storage account and you wouldn’t end up loosing data even if you delete/terminate the Server/VM, then you are safe to call your application STATELESS.</p><p>If this condition satisfies, then you are good to start off with Dockerization.</p><h3>Dockerization</h3><p>Now since your application is Stateless, you may proceed to dockerizing your application — what does that mean ?</p><p>It simply means you would package your application and its dependencies into a container (think of it as a box), which can run in any environment. Dockerization in itself is a big topic. Let me not get into it.</p><p>Once you are done with Dockerization, you are half way there to the world of Kubernetes.</p><h3>How would I deploy an application Container in Kubernetes</h3><p><strong>Self-Hosted Kubernetes</strong></p><p>Kubernetes may be hosted on a local system or may be self hosted on a VM. This would require higher level of Kubernetes knowledge and is never advised for a Stage or a Production environment. You may use tools like minikube, k3 etc to run kubernetes locally on your system to test your run time.</p><p><strong>Kubernetes as a Service</strong></p><p>Various cloud providers like AWS, Azure , GCP, Digital Ocean provides Kubernetes as a service. Once you register with them, you would be given to access to Control Plane which would be your cockpit to work with Kubernetes. Do keep in mind that Kubernetes will be a charged service, which means there will be a cost involved to run the Kubernetes environment on any cloud providers. As of today when I am writing this article, AWS charges 75$ per month per Kubernetes Cluster.</p><p>Now to the real question — should I use Kubernetes where my investments are <br>1. Time — to dockerize, learn Kubernetes<br>2. Money — to run the kubernetes Environment<br>3. Resources — Apps deployed on Kubernetes would need technical know about to be managed. Deploying new app will require you to create new YAML files for Deployment, Service, Ingress, Persistent Volumnes, etc.</p><h3>PROS of Kubernetes<br>1. Automated Deployment &amp; Scaling</h3><p>Kubernetes gives you a lot of options to scale(up and down) automatically and manage your application. There are options like Pod Autoscaler, Cluster Autoscaler, Karpenter, etc.</p><h3>2. Self-Healing</h3><p>One of the main reason we have opted for AWS Kubernetes is its capability to detect crashed application/ container and start a new replica of itself without any manual efforts — which helps us prevent downtime.</p><h3>3. Efficient Resource Utilisation</h3><p>We have multiple options in Kubernetes to efficiently use resources by setting limits limits, request, auto scaling, etc. Cluster Auto Scaling and Horizontal Pod Autoscaling are two such feature that helps in scaling.</p><h3>4. Declarative Configuration</h3><p>This would be an advantage once you understand and learn the declarative syntax of Kubernetes — which defines and declares everything as a code. It helps better management and documentation. It may be source controlled using GIT or any version control tools.</p><h3>5. Multi-Cloud &amp; Hybrid-Cloud Support</h3><p>The deployment and management files of an application may be used to be able to deploy application on ANY cloud provider. Thus making application deployment on a new environment a breeze.</p><h3>6. Rolling Updates &amp; Rollbacks</h3><p>We would be able to deploy newer version of our application without bringing down the existing application using rolling updates — which simply means — if you have an existing application, then the existing pod/container is kept active while the new container with the latest code is deployed and ensured its running. Once this happens, then hte old pod/container gets deleted. Thus ensuring there is no downtime.</p><h3>CONS of Kubernetes</h3><h3>1. Steep Learning Curve</h3><p>A lot of efforts would need to be put in order to learn and master Kubernetes. For the implementation of a production grade Kubernetes environment, a lot of learning and hands-on experience would be required else it would backfire.</p><h3>2. Cost Risk</h3><p>If not configured and monitored properly, the cost of kubernetes would sky rocket, especially if auto scaling is enabled. For example, if you have enabled autoscaling to scale based on RAM usage and your application as a memory leak, Kubernetes would keep scaling your application which would add to the cost or downtime.</p><h3>3. Debugging can be complex and time consuming</h3><p>Since Kubernetes runs on multiple layers like pod, nodes, network, ingress, volumes, services,etc — a downtime can be caused to any of the factor, and debugging at times can be complexed and time consuming. And for sure would require good Subject Knowledge.</p><h3>When Kubernetes is a Good Fit</h3><p>You have multiple microservices and want automated deployment and scaling.<br>Your team has or is building DevOps expertise.</p><p>You need high availability, portability, or hybrid/multi-cloud flexibility.</p><p>You want to adopt GitOps, CI/CD pipelines, and cloud-native practices.</p><h3>When to Consider Alternatives</h3><p>You’re running a few simple apps with limited traffic.</p><p>Your team lacks infrastructure or DevOps experience.</p><p>Serverless platforms (like AWS Lambda, Fargate, or Heroku) meet your needs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75340843a54b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular Component Interaction Parent-Child Communication]]></title>
            <link>https://medium.com/@nixonaugustine5/angular-component-interaction-parent-child-communication-2919efbef34b?source=rss-3fa4ff9614cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/2919efbef34b</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[components]]></category>
            <dc:creator><![CDATA[Nixon Augustine]]></dc:creator>
            <pubDate>Fri, 26 Jun 2020 11:26:19 GMT</pubDate>
            <atom:updated>2020-06-26T11:26:19.337Z</atom:updated>
            <content:encoded><![CDATA[<p>A quick tutorial on how to components interact with each other.</p><h4>@Input Decorator</h4><p><strong>Input</strong> ( @<strong>Input</strong>() ) is one of the most used <strong>decorators in Angular</strong> apps. It is used to pass data from the parent or host component to the child component. This <strong>decorator</strong> has a relation with DOM property in the template where the child component is used.</p><p>Lets dive into an example to understand how @Input Decorator works. Lets start by creating two components — a <strong>parent</strong> component and a <strong>child </strong>component.</p><p>The child component is hosted within the parent component.</p><p><strong><em>Parent Component</em></strong></p><pre>import { Component } from &#39;@angular/core&#39;;<br><br><strong>@Component</strong>({<br>  selector: &#39;app-parent&#39;,<br>  template: `<br>   <em> </em><strong><em>&lt;app-child [childMessage]=&quot;parentMessage&quot;&gt;&lt;/app-child&gt;</em></strong><br>  `,<br>  styleUrls: [&#39;./parent.component.css&#39;]<br>})<br>export class ParentComponent{<br>  parentMessage = &quot;message from parent&quot;<br>  constructor() { }<br>}</pre><p><strong>Child Component</strong></p><pre>import { Component, Input } from &#39;@angular/core&#39;;<br><br><strong>@Component</strong>({<br>  selector: &#39;app-child&#39;,<br>  template: `<br>      <strong>Say {{ </strong><strong><em>childMessage </em></strong><strong>}}</strong><br>  `,<br>  styleUrls: [&#39;./child.component.css&#39;]<br>})<br>export class ChildComponent {<br><br>  <strong><em>@Input() childMessage: string;</em></strong><br><br>  constructor() { }<br><br>}</pre><p>In the above example, the child compoennt is able to access the aprent component by calling the @Input() childMessage.</p><p>Thus the value of the <strong><em>childMessage </em></strong>is accessed in the child component.</p><h3>Alias</h3><p>By using an alias, the DOM property in the template can use different name. To give alias, we can give an argument in Input decorator such as @Input(&#39;my-alias-naming&#39;)</p><p>so, in the child component, we can use</p><pre><strong><em>@Input(&#39;childMessage&#39;) newMessageName: string;</em></strong></pre><p>This value can be displayed using interpolation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2919efbef34b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[localStorage and sessionStorage In Angular App]]></title>
            <link>https://medium.com/@nixonaugustine5/localstorage-and-sessionstorage-in-angular-app-65cda19283a0?source=rss-3fa4ff9614cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/65cda19283a0</guid>
            <category><![CDATA[angularjs]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[sessionstorage]]></category>
            <category><![CDATA[localstorage]]></category>
            <dc:creator><![CDATA[Nixon Augustine]]></dc:creator>
            <pubDate>Fri, 26 Jun 2020 11:07:54 GMT</pubDate>
            <atom:updated>2020-06-26T11:07:54.394Z</atom:updated>
            <content:encoded><![CDATA[<p>A short description on localStorage and sessionStorage and the usecase of each.</p><p>Both localStorage and sessionStorage are part of web API which are used to store ‘KEY’ — ‘VALUE’ pairs in Angular.</p><p>Both of them have same APIs and are easy to use.</p><p>Both of them can be accessed by client side only and server doesn&#39;t have access and thus eliminate the security threat cookies present.</p><p>The difference between localStorage and sessionStorage is that sessionStorage is lost the moment the browser is closed, while localStorage remain till the browser cache is cleared.</p><h3>localStorage</h3><h4><strong>Setting localStorage Values</strong></h4><p><strong>setItem</strong> is used to <strong>create a new key-value </strong>pair in the localStorage.<strong><br></strong><em>localStorage.</em><strong><em>setItem</em></strong><em>(‘key’, ‘value’);</em></p><p>Example</p><pre><strong><em>localStorage.setItem(‘name’,’Nixon’);</em></strong></pre><h4><strong>Getting localStorage Values</strong></h4><p><strong>getItem </strong>is used to <strong>retrieve </strong>a value that has been stored using setItem.</p><p><em>variable = localStorage.getItem(‘key’);</em></p><p>Example</p><pre><strong><em>let name = localStorage.getItem(‘name’);</em></strong></pre><h4>Removing localStorage Item</h4><p>An item in localStorage can be removed using removeItem.</p><p>localStorage.removeItem(‘key’);</p><pre><strong><em>localStorage.removeItem(‘name’);</em></strong></pre><h4>Clearing localStorage relating to a particular Domain</h4><p>In order to clear all the localStorage key-value pair related to a particular domain, we can use clear().</p><pre>localStorage.clear()</pre><p>This will remove all the localStorage related to the particular domain.</p><h3>Storing Json Objects</h3><p>Only strings can be stored with localStorage or sessionStorage, but you can use <strong>JSON.stringify </strong>to store more complex objects and <strong>JSON.parse</strong> to read them:</p><pre>// Create item:<br>let myObj = { name: &#39;Nixon&#39;, profession: &#39;Developer&#39; };<br>localStorage.setItem(key, JSON.stringify(myObj));</pre><pre>// Read item:<br>let item = JSON.parse(localStorage.getItem(key));</pre><h3>sessionStorage</h3><p>All the above API stays valid for sessionStorage also. The localStorage should be replaced with the keyword sessionStorage.</p><h4>B<strong>rowser Support for Local Storage and Session Storage:</strong></h4><p><strong>BrowserVersion</strong></p><p>Chrome 4.0<br>Firefox 3.5<br>Internet Explorer 8.0<br>Opera 10.50<br>Safari 4.0</p><p><strong>Storage Capacity:</strong></p><p>Storage capacity for <strong>localStorage and sessionStorage</strong> is vary based on browser. Generally browsers provides around 10 <strong>MB </strong>of storage space.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65cda19283a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular Reactive Forms]]></title>
            <link>https://medium.com/@nixonaugustine5/angular-reactive-forms-4a0df1f2e582?source=rss-3fa4ff9614cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a0df1f2e582</guid>
            <category><![CDATA[angular-reactive-form]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Nixon Augustine]]></dc:creator>
            <pubDate>Wed, 20 May 2020 11:28:12 GMT</pubDate>
            <atom:updated>2020-05-20T11:29:41.999Z</atom:updated>
            <content:encoded><![CDATA[<p>Angular has provided us with two ways in which we can handle forms — <strong>Template Driven Forms</strong> and <strong>Reactive Forms</strong> .</p><p>Reactive Forms gives us a wider and centralized way of handling forms — including validators and error messages.</p><p><strong>GitHub </strong>: <a href="https://github.com/nxncode/l9-angular-reactive-forms">https://github.com/nxncode/l9-angular-reactive-forms</a></p><p><a href="https://stackblitz.com/edit/l9-angular-reactive-forms"><strong>Stackbliz </strong></a>: <a href="https://stackblitz.com/edit/l9-angular-reactive-forms">https://stackblitz.com/edit/l9-angular-reactive-forms</a></p><p>Lets start off …</p><p>Like Template Driven Form, Reactive form has three steps to start implementing them .</p><p><strong>Step 1</strong> : Import ReactiveFormsModule from ‘@angular/forms’ in the application module.</p><pre>import { ReactiveFormsModule } from &#39;@angular/forms&#39;;</pre><p>Add <strong>ReactiveFormsModule </strong>to the imports array in the application module.</p><p><strong>Step 2</strong> : In the component.ts file, we have to import FormsControl, FormsGroup and Validators from the ‘@angular/forms’</p><pre>import { FormControl, FormGroup, Validators } from &#39;@angular/forms&#39;</pre><p>Next we need to create an instance of the FormGroup and FormControl. <br>If our form has two input fields, named as ‘name’ and ‘email’, then we need to create a a formGroup as below.</p><pre>formData = new FormGroup({<br>    name: new FormControl(&#39;&#39;),<br>    email: new FormControl(&#39;&#39;)<br>});</pre><p>Thus we have two formControls in a FormGroup. Next we need to bind each of the FormControl to the respective form input elements.</p><p><strong>Step 3</strong> : Creating input elements in the HTML.</p><pre>&lt;form&gt;<br>    Name:&lt;input type=&quot;text&quot;&gt;&lt;br&gt;<br>    Email:&lt;input type=&quot;text&quot;&gt;&lt;br&gt;<br>    &lt;button&gt;Submit&lt;/button&gt;<br>&lt;/form&gt;</pre><p>The above is a simple HTML form. Now we will go ahead and add formControlName to the HTML tags.</p><pre>&lt;form <strong>[formGroup]=&quot;formData&quot;</strong>&gt;<br>    Name:&lt;input type=&quot;text&quot; <strong>formControlName=&quot;name&quot;</strong>&gt;&lt;br&gt;<br>    Email:&lt;input type=&quot;text&quot; <strong>formControlName=&quot;email&quot;</strong>&gt;&lt;br&gt;<br>    &lt;button&gt;Submit&lt;/button&gt;<br>&lt;/form&gt;</pre><p>Thus we have attached the formGroup to formData and the respective controls to formControlName.</p><h3>Form Validation</h3><p>Form validation is way for developers to ensure that a data input into the form is valid. Angular provides us <strong>Validators </strong>to check if a form is valid using default conditions like <strong>required, minLength, maxLength, email,</strong> etc.</p><p><strong>How do we apply validation to a formControl?</strong></p><p>In the componets.ts file,</p><pre>formData = new FormGroup({<br>    name: new FormControl(&#39;&#39;, <strong>Validators.compose([Validators.required, Validators.minLength(5)])</strong>),<br>    email: new FormControl(&#39;&#39;,<strong>Validators.compose([Validators.required,Validators.email])</strong>)<br>});</pre><p>In the above scenario, we have added two validators to the name formControl.</p><p>First validator is <strong>Validators.required </strong>which means that the input is required and has to be filled in.</p><p>The second Validator is <strong>Validators.minLength(5)</strong> which means that the input has to have a minimum of 5 characters.</p><p><strong>Both this validators are combined together using Validators.compose.</strong></p><p><strong>If we had only one validators, validator.compose was not required. We can apply the validator directly.</strong></p><p>For the email formControl we have used <strong>Validators.email </strong>to ensure that the user input an email address.</p><h3><strong>Disabling Submit Button if Input is INVALID</strong></h3><p>Just validation wouldnt be of any use. We need to ensure that the end user is allowed to click on the button as long as the inputs are not valid.</p><p>So we can disable a button by checking if the form input is valid or invalid.</p><pre>&lt;button [disabled]=&quot;!<strong>formData.valid</strong>&quot;&gt;Submit&lt;/button&gt;</pre><p>The above will disable the button if the form is found to be invalid. The button will only be enabled as long as the form is valid — ie, the name is entered and has more than 5 characters and the email is filled with a valid email address.</p><h3>Showing Error in HTML if the user enters invalid input</h3><p>Now our form cannot be submitted as long as the user has not input valid data.</p><p>Our next task would be to show the user information on the invalid input they have entered into the input field.</p><p>Lets start with the name input field. Here there are two error possibilities — either name field is not filled in or the number of characters is less than 5.</p><p>Lets handle both of these errors.</p><pre>Name : &lt;input type=&quot;text&quot; name=&quot;name&quot; formControlName=&quot;name&quot;&gt;&lt;br&gt;</pre><pre><strong>&lt;div *ngIf = &quot;formData.controls[&#39;name&#39;].errors &amp;&amp; formData.controls[&#39;name&#39;].touched &quot;&gt;</strong></pre><pre><strong>&lt;div [hidden]=&quot;formData.controls[&#39;name&#39;].errors.required&quot;&gt;There is error. Please enter a name&lt;/div&gt;</strong></pre><pre><strong>&lt;div [hidden]=&quot;formData.controls[&#39;name&#39;].errors.minLength&quot;&gt;There is error. Please have min length&lt;/div&gt;</strong></pre><pre>&lt;/div&gt;</pre><p>In the above statement,we are first checking on the ngIf if name has an error and the input has been touched. If either of the above is true, then the corresponding divs will be displayed.</p><p>Now if required condition is not met, then the first div error will be displayed. “T<strong>here is error. Please enter a name”.</strong></p><p>Then the control will check if the input has atleast 5 characters, else the error “<strong>There is error. Please have min length of 5</strong>”</p><p>The [hidden] property binding would activate if the conditions is met.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a0df1f2e582" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular Forms — Template Driven Forms]]></title>
            <link>https://medium.com/@nixonaugustine5/angular-forms-template-driven-forms-14a94c543491?source=rss-3fa4ff9614cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/14a94c543491</guid>
            <category><![CDATA[angular-forms]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[template-driven-form]]></category>
            <dc:creator><![CDATA[Nixon Augustine]]></dc:creator>
            <pubDate>Tue, 19 May 2020 16:24:20 GMT</pubDate>
            <atom:updated>2020-05-19T16:24:20.769Z</atom:updated>
            <content:encoded><![CDATA[<h3>Angular Forms — Template Driven Forms</h3><p>Forms are the most integral part of any application. Angular is no exception to this. Angular give us two ways in which we can handle forms — <strong>Template Driven Forms and Reactive Forms</strong>.</p><h4>Stackbliz : https://stackblitz.com/edit/l7-angular-forms</h4><h4>Github : https://github.com/nxncode/L7-Angular-Forms</h4><h3><strong>Template Driven Forms</strong></h3><p>To start of with Template Driven forms, we would be needing three steps to be able to use template driven forms.</p><p><strong>Step 1</strong> : Import FormsModule into our application module from @angular/forms</p><pre>import { FormsModule } from &#39;@angular/forms&#39;;</pre><p><strong>Step 2 : Use ngForms Directive</strong></p><p>A normal forms code would look like below.</p><pre>&lt;form&gt;<br>Name : &lt;input type=&quot;text&quot;&gt;&lt;br&gt;<br>Email : &lt;input type=&quot;text&quot;&gt;&lt;br&gt;<br>&lt;button&gt;Submit&lt;/button&gt;<br>&lt;/form&gt;</pre><p>To the above form, we would be going ahead and add a id and attach it to the ngForm directive.</p><pre>&lt;form <strong>#formData=&quot;ngForm&quot;</strong>&gt;<br>Name : &lt;input type=&quot;text&quot;&gt;&lt;br&gt;<br>Email : &lt;input type=&quot;text&quot;&gt;&lt;br&gt;<br>&lt;button (click)=&quot;submitData(formData.value)&quot;&gt;Submit&lt;/button&gt;<br>&lt;/form&gt;</pre><p><strong>Step 3 </strong>: <strong>Using ngModel in the form inputs</strong></p><p>In order to register form controls on an <strong>ngForm </strong>instance, we use the <strong>ngModel </strong>directive. In combination with a <strong>name </strong>attribute,<strong> ngModel creates a form control abstraction for us behind the scenes.</strong></p><p>It has to be clearly noted that if the name attribute is missing, the ngModel would show error and the required result wouldn&#39;t be obtained.</p><pre>&lt;form <strong>#formData=&quot;ngForm&quot;</strong>&gt;<br>Name : &lt;input type=&quot;text&quot; <strong>name=&quot;name&quot; ngModel</strong>&gt;&lt;br&gt;<br>Email : &lt;input type=&quot;text&quot; <strong>name=&quot;email&quot; ngModel</strong>&gt;&lt;br&gt;<br>&lt;button <strong>(click)=&quot;submitData(formData.value)</strong>&quot;&gt;Submit&lt;/button&gt;<br>&lt;/form&gt;</pre><p>Here we are also adding a click event that would call a function submitData passing in the value of the form.</p><p>Lets go ahead and define the function submitData()</p><pre>submitData(dataFromForm){<br>   console.log(dataFromForm);<br>}</pre><p>This would console print the form data in JSON format.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14a94c543491" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular Style Binding]]></title>
            <link>https://medium.com/@nixonaugustine5/angular-style-binding-26dd5e743339?source=rss-3fa4ff9614cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/26dd5e743339</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[styled-components]]></category>
            <dc:creator><![CDATA[Nixon Augustine]]></dc:creator>
            <pubDate>Mon, 18 May 2020 06:49:16 GMT</pubDate>
            <atom:updated>2020-05-18T06:49:16.419Z</atom:updated>
            <content:encoded><![CDATA[<p>Angular Style Binding is a way defined by Angular on binding style/s to an element.</p><p>Angular Style can be bound in two ways — using <strong>ngClass </strong>and <strong>ngStyle.</strong></p><h3>STACKBLIZ</h3><p><a href="https://stackblitz.com/edit/l6-angular-style-binding">https://stackblitz.com/edit/l6-angular-style-binding</a></p><h3>GITHUB</h3><p><a href="https://github.com/nxncode/L6-Angular-Style-Binding">https://github.com/nxncode/L6-Angular-Style-Binding</a></p><h3>ngClass</h3><p>ngClass directive is used to add or remove CSS classes to an HTML element.</p><p><em>Syntax</em></p><pre><strong><em>&lt;div [ngClass]=”string | array | object | function”&gt;CONTENT&lt;/div&gt;</em></strong></pre><p>From the above syntax we understand that ngClass can take four types of inputs — a string, an array, an object or a function.</p><p>Lets look into each of the above options.</p><h3>ngClass with String as a parameter</h3><p>Lets define four style classes in our css file.</p><pre>.greenClass{<br>   color:green;<br>}<br>.italicsClass{<br>font-style: italic;<br>}<br>.boldClass{<br>font-style: bold;<br>}</pre><pre>.errorClass{<br> color:red;<br>}</pre><p>The above are four simple classes that define simple style of applying color or font formats.</p><p>Now lets create a div that has to apply one of the above style.</p><pre>&lt;div [ngClass]=&quot;&#39;greenClass&#39;&quot;&gt;Hello World. greenClass Applied&lt;/div&gt;</pre><p>By the above method, we apply the greenClass to the div. It has to noted that the <strong>class name is given in single inverted commas.</strong></p><p>We can use the same method to apply mutliple classes as a string.</p><p>That would be</p><pre>&lt;div [ngClass]=&quot;&#39;greenClass italicsClass boldClass&#39;&quot;&gt;Hello World. greenClass and Italics Class Applied&lt;/div&gt;</pre><p>In the above case, we have applied three classes that has been passed as a string.</p><h3>ngClass with ARRAY as a parameter</h3><p>Now when we have more classes that has to be applied to a HTML element, we can simplify the process by adding all the styles to a sigle array and passing the same array as the parameter to ngClass.</p><p>Let’s go ahead and create an array of style.</p><pre>styleArray = [&#39;errorClass&#39;, &#39;boldClass&#39;];</pre><p>The styleArray variable has two classes attached to it — the errorClass and the boldClass.</p><p>Now, lets add the styleArray as a parameter to the div element.</p><pre>&lt;div [ngClass]=&quot;styleArray&quot;&gt;Hello World. Array Applied.&lt;/div&gt;</pre><p>This will apply the style errorClass and boldClass to our div.</p><h3>ngClass with OBJECT as a parameter</h3><p>Let’s try adding style using an object. <strong>An object is a key-value pair.</strong></p><pre>styleObject = {<br>  &#39;errorClass&#39;: true,<br>  &#39;boldClass&#39;:true,<br>  &#39;italicsClass&#39;:true,<br>  &#39;greenClass&#39;:false<br>}</pre><p>Here we are creating an object with each style being attached to a boolean value set to <strong>TRUE </strong>or <strong>FALSE</strong>.</p><p>Now if we apply this style object to an HTML element, only those styles that are true will be applied and those which are false will not be applied.</p><p>This makes applying style to an HTML element easy as the value of object may be altered in the runtime by accessing the object in the TS file.</p><pre>&lt;div [ngClass]=”styleObject”&gt;Hellow World. Object Style Applied.&lt;/div&gt;</pre><h3>ngClass with FUNCTION as a parameter</h3><p>ngClass can take a function as a parameter. The <strong>function </strong>should <strong>return </strong>a <strong>style string, an array or an object.</strong></p><p>Lets create a function</p><pre>getGreenClass(){<br>    return &#39;greenClass&#39;;<br>}</pre><p>This function simply returns the greenClass as a string and the same get applied in the ngClass.</p><pre>&lt;div [ngClass]=&quot;getGreenClass()&quot;&gt; Hellow World. Function Returns Green Class&lt;/div&gt;</pre><p>If we need to return an object, same can be acheived throught the function.</p><pre>getGreenClass(){<br>    return this.styleObject;<br>}</pre><p>The above code will return the styleObject to the ngClass and the same will be applied.</p><h3>Conditional ngClass using Ternary Operator</h3><p>If we need to apply a class based on a condition, the same can be achieved using Ternary Operator.</p><pre>hasError : boolean = true;</pre><p>Here i have created a variable hasError which is a boolean and holds the vlaue true.</p><p>Now, we need to apply the <strong>errorClass</strong> if there is <strong>an error </strong>(i.e, hasError is set to true) and should show <strong>greenClass</strong> if there is <strong>no error </strong>(i.e, hasError is set to false.)</p><p>The above can be achieved by</p><pre>&lt;div [ngClass]=&quot;hasError ? &#39;errorClass&#39; : &#39;greenClass&#39;&quot;&gt; If hasError is true, the text will be red, else green&lt;/div&gt;</pre><h3>ngStyle</h3><p>ngStyle is used to add, edit or remove a particular style from an element.</p><p>The syntax is</p><pre>&lt;div [ngStyle]=&quot;{&#39;property&#39;:&#39;value&#39;}&quot;&gt;Div Content&lt;/div&gt;</pre><p>Now lets take an example.</p><p>If we need to apply a blue color to a div we can achive this by.</p><pre>&lt;div [ngStyle]=&quot;{&#39;color&#39;: &#39;blue&#39;}&quot;&gt; The Text Color has been set to blue &lt;div&gt;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26dd5e743339" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular Event Binding]]></title>
            <link>https://medium.com/@nixonaugustine5/angular-event-binding-7fbdb8c4425f?source=rss-3fa4ff9614cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/7fbdb8c4425f</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Nixon Augustine]]></dc:creator>
            <pubDate>Sun, 17 May 2020 03:56:16 GMT</pubDate>
            <atom:updated>2020-05-17T03:56:16.418Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Event is a way Javascript interacts with HTML(or the frontend).</blockquote><p>We use event binding in our daily programming event if we havent realized it. The simplest and the most common event binding used by any developer would be the <strong><em>click </em></strong>event that would have been attached to a button.</p><p>Angular also gives us couple of event that can be binded to a functions and thus perform particular action.</p><h3>(click) Event</h3><p>Lets start off with the simplest event. Click event is triggered when a user click on an element. Click event is usually attached to a button.</p><p>On our HTML file,</p><pre>&lt;div&gt;&lt;button (click)=&quot;displayName()&quot;&gt;Click Me&lt;/button&gt;&lt;/div&gt;</pre><pre>{{name}}</pre><p>On the TS file, we define a function displayName() that would change the value of name from ‘’ to ‘Welcome to Angular Training’;</p><pre>name = &#39;&#39;;</pre><pre>displayName(){</pre><pre>  this.name = &#39;Welcome to Angular Training&#39;;</pre><pre>}</pre><p>What happens here is when an user clicks on the button, it triggers the function displayName() which inturn changes the value of name from ‘’ to ‘Welcome to Angular Training’;</p><p>This is a simple example of a function. The same concept may be used to achieve advanced functionalities.</p><h3>(keypress), (keyup) and (keydown) Events</h3><p>There are three events that are primary attached to an input text box. The basic difference between keypress, keyup and keydown events are</p><p>The <strong>keypress</strong> event is fired when a key that produces a character value is pressed down. Examples of keys that produce a character value are alphabetic, numeric, and punctuation keys. Examples of keys that don&#39;t produce a character value are modifier keys such as Alt, Shift, Ctrl, or Meta.</p><p>The <strong>keydown</strong> event is fired when a key is pressed.</p><p>The <strong>keyup</strong> event is fired when a key is released.</p><p>Let’s go ahead and bind these events to a function.</p><pre>&lt;div&gt;</pre><pre>  Please Enter a text here (Keypress Event)&lt;br&gt;<br>  &lt;input type=&quot;text&quot; (keypress)=&quot;displayValue($event)&quot;&gt;<br>  {kPress}}</pre><pre>&lt;/div&gt;</pre><pre>&lt;div&gt;<br>  Please Enter a text here (Keyup Event)&lt;br&gt;<br>  &lt;input type=&quot;text&quot; (keyup)=&quot;displayValue($event)&quot;&gt;<br>  {{kUp}}<br>&lt;/div&gt;</pre><pre>&lt;div&gt;<br>  Please Enter a text here (Keydown Event)&lt;br&gt;<br>  &lt;input type=&quot;text&quot; (keydown)=&quot;displayValue($event)&quot;&gt;<br>  {{kDown}}<br>&lt;/div&gt;</pre><p>In the above code, we are creating three input tags of the input type text and each of the input is attached to a <strong>key event</strong>. Each key event on triggering calls a function <strong>displayValue</strong>.</p><h3>$event Object</h3><p>Angular provides a DOM event object which stores the value of the DOM event and the coresponding values attached to the DOM event.</p><p>Let’s look at a key press DOM event object.</p><pre>KeyboardEvent<br>altKey: false<br>bubbles: true<br>cancelBubble: false<br>cancelable: true<br>charCode: 97<br>code: &quot;KeyA&quot;<br>composed: true<br>ctrlKey: false<br>currentTarget: null<br>defaultPrevented: false<br>detail: 0<br>eventPhase: 0<br>isComposing: false<br>isTrusted: true<br>key: &quot;a&quot;<br>keyCode: 97<br>location: 0<br>metaKey: false<br>path: (7) [input, div, app-root, body, html, document, Window]<br>repeat: false<br>returnValue: true<br>shiftKey: false<br>sourceCapabilities: InputDeviceCapabilities {firesTouchEvents: false}<br>srcElement: input<br>target: input<br>timeStamp: 71486.25499999616<br>type: &quot;keypress&quot;<br>view: Window {parent: Window, opener: null, top: Window, length: 0, frames: Window, …}<br>which: 97<br>__proto__: KeyboardEvent</pre><p>Coming back to our example, if you notice, we are passing the $event object to the function. By passing the $event Object, we get to access the dom event and all its parameter and values. This provides a wide range of information.</p><p>Looking at the above dom object, we notice, the key that we press can be obtained by accessing the <strong>event.key</strong> value. This way all the other parameters can also be access using the same method.</p><pre>kPress=&#39;&#39;;</pre><pre>kUp=&#39;&#39;;</pre><pre>kDown=&#39;&#39;;</pre><pre>displayValue(event){<br>  console.log(event);<br>  console.log(event.key);<br>  this.kPress = this.kPress + event.key;<br>  this.kUp = this.kUp + event.key;<br>  this.kDown = this.kDown + event.key;<br>  if(event.key === &#39;Enter&#39;){<br>    console.log(&#39;You have Pressed Enter&#39;);<br>  }<br>}</pre><p>The function <strong>displayValue(event) </strong>accepts the event object and console.logs it on the first line. Then the function console.logs the key that we had pressed in the second line. Next the kPress, kUp and kDown values are added with the value of the key that was pressed.</p><p>The last if statement checks if the key that we have pressed is enter. If yes, a console log message is printed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7fbdb8c4425f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>