<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mohamed Nadir Kerroum</title>
    <description>The latest articles on DEV Community by Mohamed Nadir Kerroum (@codernadir).</description>
    <link>https://dev.to/codernadir</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1077836%2F2f806f73-e452-45df-bb19-77af7b107c1b.jpg</url>
      <title>DEV Community: Mohamed Nadir Kerroum</title>
      <link>https://dev.to/codernadir</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/codernadir"/>
    <language>en</language>
    <item>
      <title>How can Ngrok help me expose my local server worldwide?</title>
      <dc:creator>Mohamed Nadir Kerroum</dc:creator>
      <pubDate>Thu, 11 Apr 2024 10:39:12 +0000</pubDate>
      <link>https://dev.to/codernadir/how-can-ngrok-help-me-expose-my-local-server-worldwide-59mm</link>
      <guid>https://dev.to/codernadir/how-can-ngrok-help-me-expose-my-local-server-worldwide-59mm</guid>
      <description>&lt;p&gt;&lt;em&gt;&lt;strong&gt;Hi, this is CoderNadir in another post where I'll share with you how to expose your local server to the world!&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What do I mean by exposing it to the world?&lt;/strong&gt;&lt;br&gt;
I mean share a link to anyone by running a (Node/Nestjs/...) server in your local machine!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The question now is how?&lt;/strong&gt;&lt;br&gt;
Simply by the help of &lt;em&gt;&lt;a href="https://ngrok.com" rel="noopener noreferrer"&gt;Ngrok&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For this tutorial let me explain to you what is Ngrok based on what we'll use it for, and if you want to read more about it then follow this link:&lt;br&gt;
 &lt;em&gt;&lt;a href="https://ngrok.com/docs" rel="noopener noreferrer"&gt;Ngrok overview&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You can think of Ngrok like a hosting service where you can put your app and it will be public for access by anyone, but not really 😒. so keep reading and you'll get the idea clearly!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; it's only free for non-commercial use. see &lt;em&gt;&lt;a href="https://ngrok.com/pricing" rel="noopener noreferrer"&gt;pricing&lt;/a&gt;&lt;/em&gt;&lt;br&gt;
&lt;em&gt;In this tutorial I'll be using Windows 11 as OS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now let's jump into the important part from this tutorial!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1-&lt;/strong&gt; Create an account &lt;em&gt;&lt;a href="https://dashboard.ngrok.com/signup" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/em&gt;.&lt;br&gt;
&lt;strong&gt;2-&lt;/strong&gt; Chose your OS and download the ZIP folder!&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv22thm8zkp9n9cjv7u3m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv22thm8zkp9n9cjv7u3m.png" alt="Zip File" width="800" height="473"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;3-&lt;/strong&gt; Go to your downloads and extract the zip file! once you'll extract it, you'll be popped up by a window asking you where you want to extract the file! remove the path and paste this:&lt;br&gt;
&lt;code&gt;C:\ngrok&lt;/code&gt;&lt;br&gt;
Now to navigate to that extracted file we should go to:&lt;br&gt;
&lt;code&gt;C:\ngrok&lt;/code&gt; and you'll find this file:&lt;/p&gt;

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

&lt;p&gt;Now if you double click this file you'll open a Ngrok window with some details:&lt;/p&gt;

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

&lt;p&gt;You've made it right! (really 😒) not yet!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4-&lt;/strong&gt; Now we want to be able to run ngrok commands from the command line without the need to navigate to app folder and run it, therefore we'll need to set up the system environment.&lt;/p&gt;

&lt;p&gt;Search &lt;code&gt;Edit the system environment variables&lt;/code&gt; in your settings and open it!&lt;/p&gt;

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

&lt;p&gt;Then click:&lt;/p&gt;

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

&lt;p&gt;Next, Select &lt;code&gt;Path&lt;/code&gt; and click &lt;code&gt;edit&lt;/code&gt;&lt;/p&gt;

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

&lt;p&gt;Click &lt;code&gt;New&lt;/code&gt; then paste the path to your ngrok app in our case it's &lt;code&gt;C:\ngrok&lt;/code&gt; then close all the opened windows by clicking &lt;code&gt;ok&lt;/code&gt; button&lt;/p&gt;

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

&lt;p&gt;Now you can use ngrok from the command line, so open it and type: &lt;code&gt;ngrok&lt;/code&gt; and it should open a Ngrok window with some details!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; if you want to test it in your Code Editor like (VSCode) you might need to close it and open it or even restart the PC!&lt;/p&gt;

&lt;p&gt;We need another configuration before start using it, so hang on there 😀&lt;/p&gt;

&lt;p&gt;Go to your ngrok -&lt;a href="https://dashboard.ngrok.com/get-started/your-authtoken" rel="noopener noreferrer"&gt;dashboard&lt;/a&gt;_ and under the section:&lt;br&gt;
&lt;em&gt;&lt;code&gt;Getting started&lt;/code&gt;&lt;/em&gt; =&amp;gt; &lt;em&gt;&lt;code&gt;Your Authtoken&lt;/code&gt;&lt;/em&gt; &lt;br&gt;
copy your authentication token, paste it in the command line and hit enter, Command:&lt;br&gt;
&lt;code&gt;ngrok config add-authtoken &amp;lt;YOUR_AUTH_TOKEN&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Hooray! now we can start using it 🥳&lt;/p&gt;

&lt;p&gt;I'll assume that you already have a local server running, let's say on port &lt;code&gt;3000&lt;/code&gt;, cool!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5-&lt;/strong&gt; Now running the server with Ngrok&lt;br&gt;
Your ngrok command should be:&lt;br&gt;
&lt;code&gt;ngrok http 3000&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You'll see some details about your server, let's say your online app 😉&lt;br&gt;
(&lt;code&gt;1&lt;/code&gt; is your public URL server, &lt;code&gt;2&lt;/code&gt; is your forwarded local server)&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;AND BOOM 🚀 Now you know how to expose your local server to the world! 🥳&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;BUT HOLD ON!&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;WHAT IF YOU WANT TO ALSO EXPOSE YOUR DATABASE? 🤔&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;remember that your account is free and you're limited to only one forwarded server!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let me know in the comments below if I should create the second part without the need to pay! 😉🤑&lt;/p&gt;

&lt;p&gt;Catch you next time! (second part 😅)&lt;/p&gt;

</description>
      <category>codernadir</category>
      <category>nestjs</category>
      <category>tutorial</category>
      <category>ngrok</category>
    </item>
    <item>
      <title>Integrate Web3Forms in Angular</title>
      <dc:creator>Mohamed Nadir Kerroum</dc:creator>
      <pubDate>Sun, 07 May 2023 13:24:04 +0000</pubDate>
      <link>https://dev.to/codernadir/integrate-web3forms-in-angular-e8j</link>
      <guid>https://dev.to/codernadir/integrate-web3forms-in-angular-e8j</guid>
      <description>&lt;p&gt;Hi and welcome to my blog post where we are going to talk how to integrate Web3Forms in your Angular application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Web3Forms?
&lt;/h2&gt;

&lt;p&gt;I'm going to use Web3Forms for the needlessness of a back-end server, so no need to set-up a back-end API to send our emails.&lt;/p&gt;

&lt;h2&gt;
  
  
  prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Web3Forms &lt;strong&gt;&lt;em&gt;access key&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Angular basics (&lt;em&gt;&lt;strong&gt;Services&lt;/strong&gt;&lt;/em&gt;, &lt;strong&gt;&lt;em&gt;TemplateForms&lt;/em&gt;&lt;/strong&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Let's create our access key:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;first we have to submit the email that we are going to receive emails on.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdq84j8l8octzvhw5vry5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdq84j8l8octzvhw5vry5.png" alt="create web3forms access key" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;once we submit it and finish the steps, we are going to receive the access key in our email that we registered with.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0x7g2q5wtqgfkxsgqwfe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0x7g2q5wtqgfkxsgqwfe.png" alt="web3forms access key received via email" width="800" height="41"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;now register your access key here 👉 &lt;a href="https://web3forms.com/#start" rel="noopener noreferrer"&gt;Web3Forms&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Let's move to the code part:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;I'm going to assume that you already initialized your app and you have your component that has the form.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Create a service (&lt;em&gt;&lt;u&gt;&lt;strong&gt;mail&lt;/strong&gt;&lt;/u&gt;&lt;/em&gt;)
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng generate service services/mail
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;define a method called (&lt;em&gt;&lt;u&gt;&lt;strong&gt;sendEmail()&lt;/strong&gt;&lt;/u&gt;&lt;/em&gt;) that will return a &lt;em&gt;Promise&lt;/em&gt; and accept a parameter (&lt;u&gt;&lt;strong&gt;&lt;em&gt;formData&lt;/em&gt;&lt;/strong&gt;&lt;/u&gt;) that has type of (&lt;em&gt;&lt;u&gt;&lt;strong&gt;FormData&lt;/strong&gt;&lt;/u&gt;&lt;/em&gt;).&lt;/li&gt;
&lt;li&gt;in the method we are going to return the &lt;em&gt;Promise&lt;/em&gt; of the built in function (&lt;em&gt;&lt;strong&gt;&lt;u&gt;fetch()&lt;/u&gt;&lt;/strong&gt;&lt;/em&gt;), which is accepting 2 arguments:&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;API endpoint: &lt;code&gt;https://api.web3forms.com/submit&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Object with 2 properties:&lt;br&gt;
&lt;code&gt;{&lt;br&gt;
method: 'POST',&lt;br&gt;
body: formData&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;our &lt;em&gt;&lt;strong&gt;&lt;u&gt;service mail&lt;/u&gt;&lt;/strong&gt;&lt;/em&gt; method should look like:&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;that's it for the &lt;em&gt;&lt;strong&gt;&lt;u&gt;mail service&lt;/u&gt;&lt;/strong&gt;&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&gt;Now let's take a look at the HTML &lt;strong&gt;&lt;em&gt;&lt;u&gt;form&lt;/u&gt;&lt;/em&gt;&lt;/strong&gt;:
&lt;em&gt;I splitted the Form HTML code into 2 images for better view&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

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

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;As you can see we are assigning the values of the inputs to an object in our component class (&lt;u&gt;&lt;em&gt;&lt;strong&gt;&lt;u&gt;contactFormValues&lt;/u&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/u&gt;) with the help of &lt;strong&gt;&lt;em&gt;&lt;u&gt;template forms&lt;/u&gt;&lt;/em&gt;&lt;/strong&gt;, and we have a button being used to submit the form as well as we have (&lt;u&gt;&lt;em&gt;&lt;strong&gt;&lt;u&gt;ng-container&lt;/u&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/u&gt;) and (&lt;u&gt;&lt;em&gt;&lt;strong&gt;&lt;u&gt;ng-template&lt;/u&gt;&lt;/strong&gt;&lt;/em&gt;)&lt;/u&gt; inside the button tag to display whether the text (&lt;strong&gt;&lt;em&gt;send&lt;/em&gt;&lt;/strong&gt;) or show a spinning animated (&lt;em&gt;&lt;strong&gt;icon&lt;/strong&gt;&lt;/em&gt;) that indicates the form is being submitted.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Let's take a look at the component class properties and methods:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Class properties:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpvkr15ih9l3gvgxsh352.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpvkr15ih9l3gvgxsh352.png" alt="component class methods, properties" width="800" height="661"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Class methods:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

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

&lt;h2&gt;
  
  
  Class properties explanation:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;showAlert: boolean = false;&lt;/code&gt; to display alert message (success or fail).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;alertMessage: string = '';&lt;/code&gt; to hold the alert message.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;onSubmit: boolean = false;&lt;/code&gt; to set and track submit state.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;iconLoad = faArrowRotateForward;&lt;/code&gt; to define and rename the icon from (fontAwesome library).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;contactFormValues&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;contactFormValues = {
    name: '',
    email: '',
    body: '',
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to hold the inputs' values with the help of the template forms of Angular.&lt;/p&gt;

&lt;h2&gt;
  
  
  Class methods explanation:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;hideAlert()&lt;/code&gt; to hide the alert message after 5 seconds.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;submitEmail(contactForm)&lt;/code&gt; an async function that accepts an instance of the &lt;strong&gt;&lt;em&gt;&lt;u&gt;NgForm&lt;/u&gt;&lt;/em&gt;&lt;/strong&gt; to handle the submit form and in this method I want to explain 3 parts from the method:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;creating a formData instance and add values because it is the way that &lt;em&gt;Web3Forms&lt;/em&gt; accepts the form. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;formData.append('name', this.contactFormValues.name);&lt;/code&gt; add input value (&lt;em&gt;&lt;strong&gt;name&lt;/strong&gt;&lt;/em&gt;) from template to formData, follow the same step to add other inputs' values.&lt;/li&gt;
&lt;li&gt;grab your &lt;strong&gt;&lt;em&gt;&lt;u&gt;access key&lt;/u&gt;&lt;/em&gt;&lt;/strong&gt; from email you received earlier and add it into the environment variables, in my case I called it (&lt;strong&gt;&lt;em&gt;&lt;u&gt;form_access_key&lt;/u&gt;&lt;/em&gt;&lt;/strong&gt;) see example below:&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;formData.append('access_key', environment.form_access_key);&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;formData.append('subject', 'Email Support From Your Site');&lt;/code&gt; to set subject text.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;formData.append('from_name', 'Contact Notification');&lt;/code&gt; to set a name for the form.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;try | catch&lt;/code&gt; blocks, in the &lt;code&gt;try&lt;/code&gt; block we are calling the &lt;code&gt;mailService.sendEmail()&lt;/code&gt; method to submit the form and in case the form was successfully submitted we show a success message and reset the values to &lt;code&gt;null&lt;/code&gt; by the help of the instance &lt;code&gt;NgForm&lt;/code&gt; that has &lt;code&gt;reset()&lt;/code&gt; method, in our case it is &lt;code&gt;contactForm.reset()&lt;/code&gt;, and in case there is an error we added a &lt;em&gt;&lt;strong&gt;guard clause&lt;/strong&gt;&lt;/em&gt; and inside its block we throw an error to force the code to jump to the &lt;code&gt;catch&lt;/code&gt; block and show an error message.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;and at the end of the method we reset &lt;code&gt;onSubmit&lt;/code&gt; property to &lt;code&gt;false&lt;/code&gt;, &lt;code&gt;showAlert&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt; and call the &lt;code&gt;hideAlert()&lt;/code&gt; method.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;u&gt;Here we go!&lt;/u&gt;&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
 now we set everything up you can go and give it a try.&lt;br&gt;
that's it for today's post, thanks for reading and I hope you find it helpful!&lt;br&gt;
let me know your thoughts &amp;amp; opinions in the comments section!&lt;/p&gt;
&lt;/blockquote&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;website&lt;/strong&gt; 👉 &lt;a href="https://web3forms.com" rel="noopener noreferrer"&gt;Web3Forms home page&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Docs&lt;/strong&gt; 👉 &lt;a href="https://docs.web3forms.com/" rel="noopener noreferrer"&gt;Web3Forms docs link&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;blockquote&gt;
&lt;p&gt;Follow me on social media:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;👉 &lt;a href="https://instagram.com/coderNadir" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;Instagram&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;👉 &lt;a href="https://tiktok.com/@coderNadir" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;Tiktok&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;👉 &lt;a href="https://twitter.com/coderNadir" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;Twitter&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>angular</category>
      <category>web3forms</category>
      <category>forms</category>
      <category>templateforms</category>
    </item>
  </channel>
</rss>
