<?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 Nikhil Bhandarkar on Medium]]></title>
        <description><![CDATA[Stories by Nikhil Bhandarkar on Medium]]></description>
        <link>https://medium.com/@nikhil_bhandarkar?source=rss-498df5be204------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*53XltlOhLOiKFOtk.</url>
            <title>Stories by Nikhil Bhandarkar on Medium</title>
            <link>https://medium.com/@nikhil_bhandarkar?source=rss-498df5be204------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 02:00:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nikhil_bhandarkar/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[Let's understand ‘this’ once and for all.]]></title>
            <link>https://medium.com/@nikhil_bhandarkar/lets-understand-this-once-and-for-all-997503688350?source=rss-498df5be204------2</link>
            <guid isPermaLink="false">https://medium.com/p/997503688350</guid>
            <dc:creator><![CDATA[Nikhil Bhandarkar]]></dc:creator>
            <pubDate>Sat, 18 Jan 2020 04:17:48 GMT</pubDate>
            <atom:updated>2020-01-18T04:17:48.409Z</atom:updated>
            <content:encoded><![CDATA[<p>JavaScript ‘this’ keyword short notes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wCHOA_q3Z2O_SAP_" /><figcaption>Photo by <a href="https://unsplash.com/@srz?utm_source=medium&amp;utm_medium=referral">sydney Rae</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>1. ‘this’ <strong>does not</strong> <strong>refer</strong> to the <strong>function</strong> itself or to its <strong>lexical scope</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*h_F3onNwWqO6b8I-WcZ7mA.png" /></figure><p>In the above code snippet as we can see there are a bunch of <strong>functions NOT methods </strong><em>(methods are the functions declared inside Objects)</em><strong>.</strong> We are calling the above functions from the nested call site <strong>BUT </strong>this is always bonded to the globalThis OR window object because our function calls are <em>plain</em> and <em>undecorated.</em></p><blockquote>In the case of Plain and Undecorated calls this == window is always true, no matter from where you call it.</blockquote><h4>2. ‘this’ binding depends on how the function is called, not on where the function is declared</h4><p>There are mainly 4 different ways to call a function. ( <em>Sorted as Descending order of priority. First having the highest. </em>)</p><ol><li>New new Func() -&gt; this == {} // or will depend on the Func definition</li><li>Explicit func.call/apply/bind(obj) -&gt; this == obj</li><li>Implicit obj.func() -&gt; this == obj</li><li>Default (<em>Plain &amp; Undecorated</em>)func() -&gt; this == window</li></ol><h3>Examples</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/226/1*62jfQars95CUx0UkajUbmw.png" /><figcaption>ANSWER = 2. ‘this’ binds to the last level of an object property reference chain</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*pONQSB7ZhJDLPt3WS5HbpQ.png" /><figcaption>‘this’ loses it&#39;s binding and binds to ‘window’ because the assignment is just creating another reference to the existing function</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/383/1*wCmu8pe7vm7VK9mWQEMezg.png" /><figcaption>Passing a callback is the same as passing as a reference to the function. ‘setTimeout’ is a Web API called from ‘window’ object, so ‘this’ binds to ‘window’</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*fDGjI_8UnNs8Pi-b_xXnTA.png" /><figcaption>Passed as the callback, lost its binding</figcaption></figure><h4>Precedence</h4><ol><li>new obj1.func() -&gt; this == {} (<em>brand new object</em>)</li><li>obj1.func.call(obj2) -&gt; this == obj2</li><li>new and bind -&gt; this == {}</li><li>() =&gt; {} -&gt; this == ‘Immediate Parents This’</li></ol><h4>Why this blog</h4><p>A couple of weeks before I got my candidature rejected because I didn’t know these concepts of this keyword 😁. I also didn’t find any blog posts mentioning these concepts in a very straight forward way. I think these are the basics one should get right.</p><p>I recently got my copy of <a href="http://amazon.in/You-Dont-Know-Set-Volumes/dp/9352136268/ref=sr_1_fkmr1_2?crid=M31SKNYFMHJ&amp;keywords=i+dont+know+js&amp;qid=1579119901&amp;sprefix=I+dont+kn%2Caps%2C278&amp;sr=8-2-fkmr1">You Don’t Know JS Book Set</a> I think it is a must for all the JS developers out there. This blog is kind of an excerpt of the content about this in the Book Series. I encourage you to go and read that.</p><blockquote>If you are looking for basics of Angular 2 and above versions, you might want to read my other blogs.</blockquote><p>Thanks, Happy coding..!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F7DzlajZNY5D0I%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F7DzlajZNY5D0I%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F7DzlajZNY5D0I%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="281" frameborder="0" scrolling="no"><a href="https://medium.com/media/b92f65138145edba4223a42f329323c9/href">https://medium.com/media/b92f65138145edba4223a42f329323c9/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=997503688350" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create an eCommerce app with Angular and Firebase: Part 3]]></title>
            <link>https://javascript.plainenglish.io/how-to-create-an-ecommerce-app-with-angular-and-firebase-part-3-bd6012961454?source=rss-498df5be204------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd6012961454</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Nikhil Bhandarkar]]></dc:creator>
            <pubDate>Thu, 28 Mar 2019 10:51:52 GMT</pubDate>
            <atom:updated>2019-03-28T10:51:52.392Z</atom:updated>
            <content:encoded><![CDATA[<p>Part 1: <a href="https://medium.com/javascript-in-plain-english/how-to-create-an-app-using-angular-and-firebase-part-1-debb80f928ad">https://medium.com/javascript-in-plain-english/how-to-create-an-app-using-angular-and-firebase-part-1-debb80f928ad</a></p><p>Part 2: <a href="https://medium.com/javascript-in-plain-english/how-to-create-an-app-with-firebase-and-angular-part-2-79063adebab9">https://medium.com/javascript-in-plain-english/how-to-create-an-app-with-firebase-and-angular-part-2-79063adebab9</a></p><p>In this part, we will look to build out the front-end of our application. We are gonna be using Bootstrap framework to make our application look clean and beautiful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j076mAa8ls6ZWebTmN7hOg.png" /></figure><h3>Bootstrap</h3><p>Bootstrap is <strong>the</strong> most popular HTML, CSS, and JavaScript framework for web front-end development. It’s great for developing responsive, mobile-first web sites. The Bootstrap website is available at <a href="http://getbootstrap.com/">http://getbootstrap.com/</a>. The Bootstrap framework can be used together with modern JavaScript web &amp; mobile frameworks like Angular<strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8V-4UlKVRkB3SpiK6ByeZA.jpeg" /><figcaption>Angular + Bootstrap, Good idea!</figcaption></figure><h3><strong>Without any further ado let’s get our hands dirty 🙏</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*qrZrw6lftwk4qX7Ssab-iQ.jpeg" /><figcaption>Dirty hands... 💩</figcaption></figure><h4>If you can remember from the <a href="https://medium.com/@nikhilbhandarkar1998/how-to-create-e-commerce-application-using-angular-and-firebase-cloud-firestore-part-1-f4e2cba38a34">last part</a> of this blog series we have already included bootstrap in our application, so we can start coding.</h4><p>Your ‘<strong>ngCart/src/index.html</strong>’ file should look like below,</p><pre>&lt;!doctype html&gt;</pre><pre>&lt;html lang=&quot;en&quot;&gt;</pre><pre>&lt;head&gt;</pre><pre>&lt;meta charset=&quot;utf-8&quot;&gt;</pre><pre>&lt;title&gt;NgCart&lt;/title&gt;</pre><pre>&lt;base href=&quot;/&quot;&gt;</pre><pre>&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;</pre><pre>&lt;link rel=&quot;icon&quot; type=&quot;image/x-icon&quot; href=&quot;favicon.ico&quot;&gt;</pre><pre>&lt;link rel=&quot;stylesheet&quot; href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css&quot; integrity=&quot;sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm&quot; crossorigin=&quot;anonymous&quot;&gt;</pre><pre>&lt;/head&gt;</pre><pre>&lt;body&gt;</pre><pre>&lt;app-root&gt;&lt;/app-root&gt;</pre><pre>&lt;script src=&quot;https://code.jquery.com/jquery-3.2.1.slim.min.js&quot; integrity=&quot;sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;</pre><pre>&lt;script src=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js&quot; integrity=&quot;sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;</pre><pre>&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js&quot; integrity=&quot;sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;</pre><pre>&lt;/body&gt;</pre><pre>&lt;/html&gt;</pre><p>In the above code, we are including CDNs (Content Delivery Network) of Bootstrap CSS and JS files along with some necessary files like JQuery.js and Popper.js</p><p>Now as we have included all the required CDNs, we are ready to style our application. Just head over to <a href="https://getbootstrap.com/docs/4.0/components/navbar/">Bootstrap 4 </a>official documentation.</p><p>Bootstrap is a well-written CSS library we can use its components to style our application.</p><p>Copy first Navbar code, like below,</p><pre>&lt;nav class=&quot;navbar navbar-expand-lg navbar-light bg-light&quot;&gt;<br>    &lt;a class=&quot;navbar-brand&quot; routerLink=&quot;/&quot; routerLinkActive=&quot;active&quot;&gt;NgCart&lt;/a&gt;<br>    &lt;button class=&quot;navbar-toggler&quot; type=&quot;button&quot; data-toggle=&quot;collapse&quot; data-target=&quot;#navbarSupportedContent&quot; aria-controls=&quot;navbarSupportedContent&quot; aria-expanded=&quot;false&quot; aria-label=&quot;Toggle navigation&quot;&gt;<br>      &lt;span class=&quot;navbar-toggler-icon&quot;&gt;&lt;/span&gt;<br>    &lt;/button&gt;<br>  <br>    &lt;div class=&quot;collapse navbar-collapse&quot; id=&quot;navbarSupportedContent&quot;&gt;<br>      &lt;ul class=&quot;navbar-nav mr-auto&quot;&gt;<br>        &lt;li class=&quot;nav-item&quot;&gt;<br>          &lt;a class=&quot;nav-link&quot; routerLink=&quot;/user/signin&quot; routerLinkActive=&quot;active&quot;&gt;Sign In&lt;/a&gt;<br>        &lt;/li&gt;<br>        &lt;li class=&quot;nav-item&quot;&gt;<br>          &lt;a class=&quot;nav-link&quot; routerLink=&quot;/user/signup&quot; routerLinkActive=&quot;active&quot;&gt;Sign Up&lt;/a&gt;<br>        &lt;/li&gt;<br>      &lt;/ul&gt;<br>    &lt;/div&gt;<br>  &lt;/nav&gt;</pre><p>In above I have included ‘routerLink’ attribute which would redirect us to certain routes like mentioned in quotes.</p><p>This is a responsive Navbar which will adjust itself according to the screen size of the device.</p><p>Add this code in ‘<strong>src/app/app.component.html</strong>’ file above the container div. Your ‘<strong>src/app/app.component.html</strong>’should look like this.</p><pre>&lt;nav class=&quot;navbar navbar-expand-lg navbar-light bg-light&quot;&gt;<br>    &lt;a class=&quot;navbar-brand&quot; routerLink=&quot;/&quot; routerLinkActive=&quot;active&quot;&gt;NgCart&lt;/a&gt;<br>    &lt;button class=&quot;navbar-toggler&quot; type=&quot;button&quot; data-toggle=&quot;collapse&quot; data-target=&quot;#navbarSupportedContent&quot; aria-controls=&quot;navbarSupportedContent&quot; aria-expanded=&quot;false&quot; aria-label=&quot;Toggle navigation&quot;&gt;<br>        &lt;span class=&quot;navbar-toggler-icon&quot;&gt;&lt;/span&gt;<br>    &lt;/button&gt;</pre><pre>&lt;div class=&quot;collapse navbar-collapse&quot; id=&quot;navbarSupportedContent&quot;&gt;<br>        &lt;ul class=&quot;navbar-nav mr-auto&quot;&gt;<br>        &lt;li class=&quot;nav-item&quot;&gt;<br>            &lt;a class=&quot;nav-link&quot; routerLink=&quot;/user/signin&quot; routerLinkActive=&quot;active&quot;&gt;Sign In&lt;/a&gt;<br>        &lt;/li&gt;<br>        &lt;li class=&quot;nav-item&quot;&gt;<br>            &lt;a class=&quot;nav-link&quot; routerLink=&quot;/user/signup&quot; routerLinkActive=&quot;active&quot;&gt;Sign Up&lt;/a&gt;<br>        &lt;/li&gt;<br>        &lt;/ul&gt;<br>    &lt;/div&gt;<br>&lt;/nav&gt;</pre><pre>&lt;div class=&quot;container&quot;&gt;<br>    &lt;router-outlet&gt;&lt;/router-outlet&gt;<br>&lt;/div&gt;</pre><p>Now you can go style your application as you want, just search for particular UI component and you will get the required code.</p><p>Here is how I designed our Angular component.</p><p>‘<strong>admin-products.component.html</strong>’</p><pre>&lt;div class=&quot;row&quot;&gt;<br>    &lt;div class=&quot;card col&quot; style=&quot;width: 18rem;&quot;&gt;<br>      &lt;img class=&quot;card-img-top&quot; src=&quot;<a href="https://images-na.ssl-images-amazon.com/images/I/61PGMP8d5PL._SX425_.jpg">https://images-na.ssl-images-amazon.com/images/I/61PGMP8d5PL._SX425_.jpg</a>&quot; alt=&quot;Card image cap&quot;&gt;<br>      &lt;div class=&quot;card-body&quot;&gt;<br>        &lt;h5 class=&quot;card-title&quot;&gt;Dell Inspiron N15R&lt;/h5&gt;<br>        &lt;p class=&quot;card-text&quot;&gt; Price : 40000&lt;/p&gt;<br>        &lt;a href=&quot;#&quot; class=&quot;btn btn-primary&quot;&gt;Buy Now&lt;/a&gt;<br>        &lt;a href=&quot;#&quot; class=&quot;btn btn-danger&quot;&gt;Delete&lt;/a&gt;<br>        &lt;a href=&quot;#&quot; class=&quot;btn btn-warning&quot;&gt;edit&lt;/a&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>    &lt;div class=&quot;card col&quot; style=&quot;width: 18rem;&quot;&gt;<br>      &lt;img class=&quot;card-img-top&quot; src=&quot;<a href="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR8Ly4FD_xmz5Lva-tk6VRabgeKBZkRv8NoJ4ooJ1EwGSCcYFATwg">https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR8Ly4FD_xmz5Lva-tk6VRabgeKBZkRv8NoJ4ooJ1EwGSCcYFATwg</a>&quot; alt=&quot;Card image cap&quot;&gt;<br>      &lt;div class=&quot;card-body&quot;&gt;<br>        &lt;h5 class=&quot;card-title&quot;&gt;HP Elitebook E840&lt;/h5&gt;<br>        &lt;p class=&quot;card-text&quot;&gt; Price : 42000&lt;/p&gt;<br>        &lt;a href=&quot;#&quot; class=&quot;btn btn-primary&quot;&gt;Buy Now&lt;/a&gt;<br>        &lt;a href=&quot;#&quot; class=&quot;btn btn-danger&quot;&gt;Delete&lt;/a&gt;<br>        &lt;a href=&quot;#&quot; class=&quot;btn btn-warning&quot;&gt;edit&lt;/a&gt;<br>      &lt;/div&gt;<br>      <br>    &lt;/div&gt;<br>  <br>    &lt;div class=&quot;card col&quot; style=&quot;width: 18rem;&quot;&gt;<br>        &lt;img class=&quot;card-img-top&quot; src=&quot;<a href="https://images-na.ssl-images-amazon.com/images/I/61PGMP8d5PL._SX425_.jpg">https://images-na.ssl-images-amazon.com/images/I/61PGMP8d5PL._SX425_.jpg</a>&quot; alt=&quot;Card image cap&quot;&gt;<br>        &lt;div class=&quot;card-body&quot;&gt;<br>          &lt;h5 class=&quot;card-title&quot;&gt;Dell Inspiron N15R&lt;/h5&gt;<br>          &lt;p class=&quot;card-text&quot;&gt; Price : 52000&lt;/p&gt;<br>          &lt;a href=&quot;#&quot; class=&quot;btn btn-primary&quot;&gt;Buy Now&lt;/a&gt;<br>          &lt;a href=&quot;#&quot; class=&quot;btn btn-danger&quot;&gt;Delete&lt;/a&gt;<br>        &lt;a href=&quot;#&quot; class=&quot;btn btn-warning&quot;&gt;edit&lt;/a&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>  <br>      &lt;div class=&quot;card col&quot; style=&quot;width: 18rem;&quot;&gt;<br>          &lt;img class=&quot;card-img-top&quot; src=&quot;<a href="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR8Ly4FD_xmz5Lva-tk6VRabgeKBZkRv8NoJ4ooJ1EwGSCcYFATwg">https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR8Ly4FD_xmz5Lva-tk6VRabgeKBZkRv8NoJ4ooJ1EwGSCcYFATwg</a>&quot; alt=&quot;Card image cap&quot;&gt;<br>          &lt;div class=&quot;card-body&quot;&gt;<br>            &lt;h5 class=&quot;card-title&quot;&gt;HP Elitebook E840&lt;/h5&gt;<br>            &lt;p class=&quot;card-text&quot;&gt; Price : 62000&lt;/p&gt;<br>            &lt;a href=&quot;#&quot; class=&quot;btn btn-primary&quot;&gt;Buy Now&lt;/a&gt;<br>            &lt;a href=&quot;#&quot; class=&quot;btn btn-danger&quot;&gt;Delete&lt;/a&gt;<br>        &lt;a href=&quot;#&quot; class=&quot;btn btn-warning&quot;&gt;edit&lt;/a&gt;<br>          &lt;/div&gt;<br>          <br>        &lt;/div&gt;<br>  &lt;/div&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_vJW-r3XBnw-oR3vSwXJvQ.png" /><figcaption><strong>admin-products.component.html</strong></figcaption></figure><p>‘<strong>admin-users.component.html</strong>’</p><pre>&lt;table class=&quot;table table-striped&quot;&gt;<br>    &lt;thead&gt;<br>      &lt;tr&gt;<br>        &lt;th scope=&quot;col&quot;&gt;#&lt;/th&gt;<br>        &lt;th scope=&quot;col&quot;&gt;UserName&lt;/th&gt;<br>        &lt;th scope=&quot;col&quot;&gt;Email&lt;/th&gt;<br>        &lt;th scope=&quot;col&quot;&gt;Phone Number&lt;/th&gt;<br>        &lt;th scope=&quot;col&quot;&gt;Operations &lt;/th&gt;<br>      &lt;/tr&gt;<br>    &lt;/thead&gt;<br>    &lt;tbody&gt;<br>      &lt;tr&gt;<br>        &lt;th scope=&quot;row&quot;&gt;1&lt;/th&gt;<br>        &lt;td&gt;Mark&lt;/td&gt;<br>        &lt;td&gt;<a href="/service/mailto:mark@gmail.com">mark@gmail.com</a>&lt;/td&gt;<br>        &lt;td&gt;1234567890&lt;/td&gt;<br>        &lt;td&gt;<br>          &lt;a href=&quot;#&quot; class=&quot;btn btn-danger&quot;&gt;Delete&lt;/a&gt;<br>          &lt;a href=&quot;#&quot; class=&quot;btn btn-warning&quot;&gt;edit&lt;/a&gt;<br>        &lt;/td&gt;<br>      &lt;/tr&gt;<br>      &lt;tr&gt;<br>        &lt;th scope=&quot;row&quot;&gt;2&lt;/th&gt;<br>        &lt;td&gt;Jacob&lt;/td&gt;<br>        &lt;td&gt;<a href="/service/mailto:jacob@gmail.com">jacob@gmail.com</a>&lt;/td&gt;<br>        &lt;td&gt;1234567890&lt;/td&gt;<br>        &lt;td&gt;<br>            &lt;a href=&quot;#&quot; class=&quot;btn btn-danger&quot;&gt;Delete&lt;/a&gt;<br>            &lt;a href=&quot;#&quot; class=&quot;btn btn-warning&quot;&gt;edit&lt;/a&gt;<br>          &lt;/td&gt;<br>      &lt;/tr&gt;<br>      &lt;tr&gt;<br>        &lt;th scope=&quot;row&quot;&gt;3&lt;/th&gt;<br>        &lt;td&gt;Larry&lt;/td&gt;<br>        &lt;td&gt;<a href="/service/mailto:larry@gmail.com">larry@gmail.com</a>&lt;/td&gt;<br>        &lt;td&gt;1234567890&lt;/td&gt;<br>        &lt;td&gt;<br>            &lt;a href=&quot;#&quot; class=&quot;btn btn-danger&quot;&gt;Delete&lt;/a&gt;<br>            &lt;a href=&quot;#&quot; class=&quot;btn btn-warning&quot;&gt;edit&lt;/a&gt;<br>          &lt;/td&gt;<br>      &lt;/tr&gt;<br>    &lt;/tbody&gt;<br>  &lt;/table&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QFfNRQAr0L1pO7ErzLO5Tw.png" /><figcaption><strong>admin-users.component.html</strong></figcaption></figure><p>‘<strong>cart.component.html</strong>’</p><pre>&lt;div class=&quot;row&quot;&gt;<br>    &lt;div class=&quot;card col&quot; style=&quot;width: 18rem;&quot;&gt;<br>      &lt;img class=&quot;card-img-top&quot; src=&quot;<a href="https://images-na.ssl-images-amazon.com/images/I/61PGMP8d5PL._SX425_.jpg">https://images-na.ssl-images-amazon.com/images/I/61PGMP8d5PL._SX425_.jpg</a>&quot; alt=&quot;Card image cap&quot;&gt;<br>      &lt;div class=&quot;card-body&quot;&gt;<br>        &lt;h5 class=&quot;card-title&quot;&gt;Dell Inspiron N15R&lt;/h5&gt;<br>        &lt;p class=&quot;card-text&quot;&gt; Price : 42000&lt;/p&gt;<br>        &lt;a href=&quot;#&quot; class=&quot;btn btn-primary&quot;&gt;Buy Now&lt;/a&gt;<br>        &lt;a href=&quot;#&quot; class=&quot;btn btn-danger&quot;&gt;Delete&lt;/a&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>    &lt;div class=&quot;card col&quot; style=&quot;width: 18rem;&quot;&gt;<br>      &lt;img class=&quot;card-img-top&quot; src=&quot;<a href="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR8Ly4FD_xmz5Lva-tk6VRabgeKBZkRv8NoJ4ooJ1EwGSCcYFATwg">https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR8Ly4FD_xmz5Lva-tk6VRabgeKBZkRv8NoJ4ooJ1EwGSCcYFATwg</a>&quot; alt=&quot;Card image cap&quot;&gt;<br>      &lt;div class=&quot;card-body&quot;&gt;<br>        &lt;h5 class=&quot;card-title&quot;&gt;HP Elitebook E840&lt;/h5&gt;<br>        &lt;p class=&quot;card-text&quot;&gt; Price : 48000&lt;/p&gt;<br>        &lt;a href=&quot;#&quot; class=&quot;btn btn-primary&quot;&gt;Buy Now&lt;/a&gt;<br>        &lt;a href=&quot;#&quot; class=&quot;btn btn-danger&quot;&gt;Delete&lt;/a&gt;  <br>      &lt;/div&gt;<br>      <br>    &lt;/div&gt;<br>  <br>    &lt;div class=&quot;card col&quot; style=&quot;width: 18rem;&quot;&gt;<br>        &lt;img class=&quot;card-img-top&quot; src=&quot;<a href="https://images-na.ssl-images-amazon.com/images/I/61PGMP8d5PL._SX425_.jpg">https://images-na.ssl-images-amazon.com/images/I/61PGMP8d5PL._SX425_.jpg</a>&quot; alt=&quot;Card image cap&quot;&gt;<br>        &lt;div class=&quot;card-body&quot;&gt;<br>          &lt;h5 class=&quot;card-title&quot;&gt;Dell Inspiron N17R&lt;/h5&gt;<br>          &lt;p class=&quot;card-text&quot;&gt; Price : 52000&lt;/p&gt;<br>          &lt;a href=&quot;#&quot; class=&quot;btn btn-primary&quot;&gt;Buy Now&lt;/a&gt;<br>          &lt;a href=&quot;#&quot; class=&quot;btn btn-danger&quot;&gt;Delete&lt;/a&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>  <br>      &lt;div class=&quot;card col&quot; style=&quot;width: 18rem;&quot;&gt;<br>          &lt;img class=&quot;card-img-top&quot; src=&quot;<a href="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR8Ly4FD_xmz5Lva-tk6VRabgeKBZkRv8NoJ4ooJ1EwGSCcYFATwg">https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR8Ly4FD_xmz5Lva-tk6VRabgeKBZkRv8NoJ4ooJ1EwGSCcYFATwg</a>&quot; alt=&quot;Card image cap&quot;&gt;<br>          &lt;div class=&quot;card-body&quot;&gt;<br>            &lt;h5 class=&quot;card-title&quot;&gt;HP Elitebook E846&lt;/h5&gt;<br>            &lt;p class=&quot;card-text&quot;&gt; Price : 62000&lt;/p&gt;<br>            &lt;a href=&quot;#&quot; class=&quot;btn btn-primary&quot;&gt;Buy Now&lt;/a&gt;<br>            &lt;a href=&quot;#&quot; class=&quot;btn btn-danger&quot;&gt;Delete&lt;/a&gt;<br>          &lt;/div&gt;<br>          <br>        &lt;/div&gt;<br>  &lt;/div&gt;</pre><pre>&lt;form&gt;<br>      <br>      &lt;div class=&quot;form-check&quot;&gt;<br>        &lt;h3&gt;Total amount: &lt;/h3&gt;<br>      &lt;/div&gt;<br>      &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Checkout&lt;/button&gt;<br>    &lt;/form&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t7-JPa5mQE0rzYPym_siEw.png" /><figcaption><strong>cart.component.html</strong></figcaption></figure><p>‘<strong>products.component.html</strong>’</p><pre>&lt;div class=&quot;row&quot;&gt;<br>  &lt;div class=&quot;card col&quot; style=&quot;width: 18rem;&quot;&gt;<br>    &lt;img class=&quot;card-img-top&quot; src=&quot;<a href="https://images-na.ssl-images-amazon.com/images/I/61PGMP8d5PL._SX425_.jpg">https://images-na.ssl-images-amazon.com/images/I/61PGMP8d5PL._SX425_.jpg</a>&quot; alt=&quot;Card image cap&quot;&gt;<br>    &lt;div class=&quot;card-body&quot;&gt;<br>      &lt;h5 class=&quot;card-title&quot;&gt;Dell Inspiron N15R&lt;/h5&gt;<br>      &lt;p class=&quot;card-text&quot;&gt; Price : 40000&lt;/p&gt;<br>      &lt;a href=&quot;#&quot; class=&quot;btn btn-primary&quot;&gt;Buy Now&lt;/a&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>  &lt;div class=&quot;card col&quot; style=&quot;width: 18rem;&quot;&gt;<br>    &lt;img class=&quot;card-img-top&quot; src=&quot;<a href="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR8Ly4FD_xmz5Lva-tk6VRabgeKBZkRv8NoJ4ooJ1EwGSCcYFATwg">https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR8Ly4FD_xmz5Lva-tk6VRabgeKBZkRv8NoJ4ooJ1EwGSCcYFATwg</a>&quot; alt=&quot;Card image cap&quot;&gt;<br>    &lt;div class=&quot;card-body&quot;&gt;<br>      &lt;h5 class=&quot;card-title&quot;&gt;HP Elitebook E840&lt;/h5&gt;<br>      &lt;p class=&quot;card-text&quot;&gt; Price : 42000&lt;/p&gt;<br>      &lt;a href=&quot;#&quot; class=&quot;btn btn-primary&quot;&gt;Buy Now&lt;/a&gt;<br>    &lt;/div&gt;<br>    <br>  &lt;/div&gt;</pre><pre>&lt;div class=&quot;card col&quot; style=&quot;width: 18rem;&quot;&gt;<br>      &lt;img class=&quot;card-img-top&quot; src=&quot;<a href="https://images-na.ssl-images-amazon.com/images/I/61PGMP8d5PL._SX425_.jpg">https://images-na.ssl-images-amazon.com/images/I/61PGMP8d5PL._SX425_.jpg</a>&quot; alt=&quot;Card image cap&quot;&gt;<br>      &lt;div class=&quot;card-body&quot;&gt;<br>        &lt;h5 class=&quot;card-title&quot;&gt;Dell Inspiron N15R&lt;/h5&gt;<br>        &lt;p class=&quot;card-text&quot;&gt; Price : 52000&lt;/p&gt;<br>        &lt;a href=&quot;#&quot; class=&quot;btn btn-primary&quot;&gt;Buy Now&lt;/a&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;</pre><pre>&lt;div class=&quot;card col&quot; style=&quot;width: 18rem;&quot;&gt;<br>        &lt;img class=&quot;card-img-top&quot; src=&quot;<a href="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR8Ly4FD_xmz5Lva-tk6VRabgeKBZkRv8NoJ4ooJ1EwGSCcYFATwg">https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR8Ly4FD_xmz5Lva-tk6VRabgeKBZkRv8NoJ4ooJ1EwGSCcYFATwg</a>&quot; alt=&quot;Card image cap&quot;&gt;<br>        &lt;div class=&quot;card-body&quot;&gt;<br>          &lt;h5 class=&quot;card-title&quot;&gt;HP Elitebook E840&lt;/h5&gt;<br>          &lt;p class=&quot;card-text&quot;&gt; Price : 62000&lt;/p&gt;<br>          &lt;a href=&quot;#&quot; class=&quot;btn btn-primary&quot;&gt;Buy Now&lt;/a&gt;<br>        &lt;/div&gt;<br>        <br>      &lt;/div&gt;<br>&lt;/div&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_EcFiUsOGGMNV5PrgRehXQ.png" /><figcaption><strong>products.component.html</strong></figcaption></figure><p>‘<strong>sign-in.component.html</strong>’</p><pre>&lt;form&gt;<br>  &lt;div class=&quot;form-group&quot;&gt;<br>    &lt;label for=&quot;exampleInputEmail1&quot;&gt;Email address&lt;/label&gt;<br>    &lt;input type=&quot;email&quot; class=&quot;form-control&quot; id=&quot;exampleInputEmail1&quot; aria-describedby=&quot;emailHelp&quot; placeholder=&quot;Enter email&quot;&gt;<br>    &lt;small id=&quot;emailHelp&quot; class=&quot;form-text text-muted&quot;&gt;We&#39;ll never share your email with anyone else.&lt;/small&gt;<br>  &lt;/div&gt;<br>  &lt;div class=&quot;form-group&quot;&gt;<br>    &lt;label for=&quot;exampleInputPassword1&quot;&gt;Password&lt;/label&gt;<br>    &lt;input type=&quot;password&quot; class=&quot;form-control&quot; id=&quot;exampleInputPassword1&quot; placeholder=&quot;Password&quot;&gt;<br>  &lt;/div&gt;<br>  &lt;div class=&quot;form-check&quot;&gt;<br>    &lt;input type=&quot;checkbox&quot; class=&quot;form-check-input&quot; id=&quot;exampleCheck1&quot;&gt;<br>    &lt;label class=&quot;form-check-label&quot; for=&quot;exampleCheck1&quot;&gt;Check me out&lt;/label&gt;<br>  &lt;/div&gt;<br>  &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Sign In<br>  &lt;/button&gt;<br>&lt;/form&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ouTTpycEjCVxePAqlOaWUA.png" /><figcaption><strong>sign-in.component.html</strong></figcaption></figure><p>‘<strong>sign-up.component.html</strong>’</p><pre>&lt;form&gt;<br>    &lt;div class=&quot;form-row&quot;&gt;<br>      &lt;div class=&quot;form-group col-md-6&quot;&gt;<br>        &lt;label for=&quot;inputEmail4&quot;&gt;Email&lt;/label&gt;<br>        &lt;input type=&quot;email&quot; class=&quot;form-control&quot; id=&quot;inputEmail4&quot; placeholder=&quot;Email&quot;&gt;<br>      &lt;/div&gt;<br>      &lt;div class=&quot;form-group col-md-6&quot;&gt;<br>        &lt;label for=&quot;inputPassword4&quot;&gt;Password&lt;/label&gt;<br>        &lt;input type=&quot;password&quot; class=&quot;form-control&quot; id=&quot;inputPassword4&quot; placeholder=&quot;Password&quot;&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>    &lt;div class=&quot;form-group&quot;&gt;<br>      &lt;label for=&quot;fullName&quot;&gt;Full Name&lt;/label&gt;<br>      &lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;fullName&quot;&gt;<br>    &lt;/div&gt;<br>    &lt;div class=&quot;form-group&quot;&gt;<br>      &lt;label for=&quot;phoneNumber&quot;&gt;Phone Number&lt;/label&gt;<br>      &lt;input type=&quot;number&quot; class=&quot;form-control&quot; id=&quot;phoneNumber&quot;&gt;<br>    &lt;/div&gt;<br>    &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Sign Up&lt;/button&gt;<br>  &lt;/form&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w6y0vxyV7VmhrKoxGww7xw.png" /><figcaption><strong>sign-up.component.html</strong></figcaption></figure><p>And everything is working perfectly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*IEI1eR3IkTERKm_ploBf-w.jpeg" /><figcaption>Oh Yeah..!</figcaption></figure><p>Now you can go add some more functionalities if you want. I will insist you go and play with all those Bootstrap components and make our application an eye candy.</p><p>In the next part of this series, I will describe everything to do with setting up firebase authentication. Until then Happy Coding 😋.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3ohs7KViF6rA4aan5u%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3ohs7KViF6rA4aan5u%2Fsource.mp4&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F3ohs7KViF6rA4aan5u%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="320" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca62839f02432a885a1f73e81b1fc417/href">https://medium.com/media/ca62839f02432a885a1f73e81b1fc417/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd6012961454" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/how-to-create-an-ecommerce-app-with-angular-and-firebase-part-3-bd6012961454">How to create an eCommerce app with Angular and Firebase: Part 3</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create an eCommerce app with Angular and Firebase: Part 2]]></title>
            <link>https://javascript.plainenglish.io/how-to-create-an-app-with-firebase-and-angular-part-2-79063adebab9?source=rss-498df5be204------2</link>
            <guid isPermaLink="false">https://medium.com/p/79063adebab9</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Nikhil Bhandarkar]]></dc:creator>
            <pubDate>Mon, 04 Mar 2019 12:16:00 GMT</pubDate>
            <atom:updated>2023-02-20T16:51:32.597Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to create an e-commerce web app with Angular and Firebase (Cloud Firestore)</h4><p>Part 1: <a href="https://medium.com/javascript-in-plain-english/how-to-create-an-app-using-angular-and-firebase-part-1-debb80f928ad">https://medium.com/javascript-in-plain-english/how-to-create-an-app-using-angular-and-firebase-part-1-debb80f928ad</a></p><p>Part 2:</p><p>Now in this part, we are going to connect our application with our database which is Firebase Cloud Firestore.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*KP_lg7YV4bySD2eWcVsxoA.png" /><figcaption>Firebase Cloud Firestore + Angular</figcaption></figure><p>To get started just head over to <a href="http://console.firebase.google.com/"><strong>console.firebase.google.com</strong></a><strong> </strong>login with your Google credentials.</p><p>Create a new Firebase app on your Firebase console by clicking on “Add project” and type any suitable name for your project. I am gonna name it ‘ngCart’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IXjMkMR5qGJ3gGDSn2x5fA.png" /><figcaption>Click on Add Project button.</figcaption></figure><p>This is how we will get a Firebase application.</p><p>Now visit the <a href="http://console.cloud.google.com/apis/library">Google Cloud Console</a> and select the project to add the Google Cloud Firestore API to the library.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aZ9bUpsm9S7BLfVowjdt7g.png" /><figcaption>search for API</figcaption></figure><p>Click on enable <strong>API</strong> for our created project.</p><p>Get credentials by clicking on create credentials button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*naVOnppE3gKcx4LJDWA4og.jpeg" /><figcaption>Create Credentials</figcaption></figure><p>It asks which API you are using</p><p>Select Cloud Firestore API from a dropdown, we don’t need any special credentials to default credentials will work for us.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_rNCaGqfK_j1SFFEjXNCXg.jpeg" /><figcaption>Add Credentials</figcaption></figure><p>Now head over to <strong>Firebase console</strong> -&gt; <strong>Database</strong> and click on <strong>Cloud Firestore.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IpUBK1-Fidw2KSbkPu7UjQ.jpeg" /></figure><p><strong>Click on create database</strong> -&gt; <strong>start in test mode</strong> -&gt; <strong>Enable</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lhMPPvaQZ3DVFd5sEQDYLw.jpeg" /><figcaption>Enable rules</figcaption></figure><p>So we are done with creating our database and ready to connect our application with the database we have been setting up.</p><p>Click on <strong>Project Overview</strong> present on the top left corner of your <strong>Firebase</strong>console</p><p>Click on that <strong>&lt;/&gt;</strong>icon.</p><p>Copy whatever is there in those curly braces.</p><p>Open <strong>‘src/environments/environment.ts’</strong> file in any code editor.</p><p>Your <strong>environment.ts</strong> file should look like this,</p><pre>//src/environments/environment.ts</pre><pre>export const environment = {<br>  production: false,<br>  firebase: {<br>   apiKey: &quot;*****************************************&quot;,<br>    authDomain: &quot;app-***.firebaseapp.com&quot;,<br>    databaseURL: &quot;<a href="https://ngcart-58f8b.firebaseio.com/">https://*********.firebaseio.com</a>&quot;,<br>    projectId: &quot;<a href="https://ngcart-58f8b.firebaseio.com/">*********</a>&quot;,<br>    storageBucket: &quot;<a href="https://ngcart-58f8b.firebaseio.com/">*********</a>.appspot.com&quot;,<br>    messagingSenderId: &quot;<a href="https://ngcart-58f8b.firebaseio.com/">*********</a>&quot;<br>  }<br>};</pre><p>Import <strong>environment.ts</strong> file in <strong>app.module.ts</strong>, just add below line after all imports</p><pre>import { environment } from &#39;../environments/environment&#39;;</pre><p>Now let’s import the module that comes with the Angular library for Firebase/Cloud Firestore. Run below command in the parent directory of your application.</p><pre>npm install <a href="http://twitter.com/angular/fire">@angular/fire</a> firebase --save</pre><p>Import following module in <strong>‘app.module.ts’</strong> file</p><pre>//app.module.ts<br>import { AngularFireModule } from &#39;<a href="http://twitter.com/angular/fire">@angular/fire</a>&#39;;<br>import { AngularFirestore } from &#39;<a href="http://twitter.com/angular/fire">@angular/fire</a>/firestore&#39;;<br>import { AngularFirestoreModule } from &#39;<a href="http://twitter.com/angular/fire">@angular/fire</a>/firestore&#39;;</pre><p>Append <strong>Imports</strong> array in <strong>‘app.module.ts’</strong> file</p><pre>//app.module.ts<br>imports: [<br>    BrowserModule,<br>    HttpClientModule,<br>    AppRoutingModule,<br>    AngularFireModule.initializeApp(environment.firebase),<br>    AngularFirestoreModule<br>  ],</pre><p>So finally we are done with connecting database with our application.</p><p>Let’s add some data to our database so that we can fetch.</p><p>Go to your <strong>Firebase Console </strong>-&gt;<strong> Database </strong>-&gt;<strong>Add Collection</strong></p><p>And type the name of your collection as items, as we are building e-commerce like the application we will need items to list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ei9XmJiYKKX8vnFaeTBzQ.png" /><figcaption>Add Collection</figcaption></figure><p>Create some random data to work on, like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yq77lCEN0iBy0XasE5EDNw.png" /></figure><p>Now we will modify our <strong>‘/src/app/products/products.component.ts’ </strong>and import observable along with the code to fetch data from the database.</p><p>Data will be returned as an observable, hence we need to create an observable ‘items: Observable&lt;any[]&gt;’ its datatype is ‘any’ so that it can have any sort of data.</p><pre>// src/app/products/products.component.ts</pre><pre>import { Component, OnInit } from &#39;<a href="http://twitter.com/angular/core">@angular/core</a>&#39;;<br>import { AngularFirestore } from &#39;@angular/fire/firestore&#39;;<br>import { Observable } from &#39;rxjs&#39;;</pre><pre><a href="http://twitter.com/Component">@Component</a>({<br>  selector: &#39;app-products&#39;,<br>  templateUrl: &#39;./products.component.html&#39;,<br>  styleUrls: [&#39;./products.component.css&#39;]<br>})<br>export class ProductsComponent implements OnInit {</pre><pre>items: Observable&lt;any[]&gt;;<br>  <br>  constructor(db: AngularFirestore) {<br>    this.items = db.collection(&#39;items&#39;).valueChanges();<br>  }</pre><pre>ngOnInit() {<br>  }</pre><pre>}</pre><p>Then we will write some code in the constructor so that it gets executed on the component creation.</p><blockquote>Here is the link to official <a href="https://github.com/angular/angularfire2"><strong>Angular +Firebase Documentation</strong></a></blockquote><p>Now let’s create some frontend thing to show what we’ve got in our database, just append below code to <strong>‘/src/app/products/products.component.html’</strong></p><pre>// src/app/products/products.component.html</pre><pre>&lt;p&gt;<br>  products works!<br>&lt;/p&gt;<br>&lt;router-outlet&gt;&lt;/router-outlet&gt;</pre><pre>&lt;ul&gt;<br> &lt;li *ngFor=&quot;let item of items | async&quot;&gt;<br>   &lt;h1&gt;{{ item.productName }}&lt;/h1&gt;<br>   {{ item.price }}<br> &lt;/li&gt;<br>&lt;/ul&gt;</pre><p>Finally, we are done and I hope this should work. Just serve your application from your parent directory by running below command,</p><pre>ng s -o</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pOJ4OPs4oPeeoeCR5b7GGQ.png" /></figure><h3>If something like above shows up, congrats we’ve done it.</h3><p><strong>This is it ;) for this part, in the next part we will style our application using bootstrap 4. Until then get your application up and running.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*1J2BTNQpdBSuQ3OGxQJIXQ.gif" /><figcaption>Happy Coding</figcaption></figure><blockquote><strong>Here is the boilerplate of blank Angular project connected to the Firebase. Give it a star and clone it to get started with your new Angular Firebase project. ;)</strong></blockquote><p><a href="https://github.com/whyDontI/angularFirebaseFirestore">whyDontI/angularFirebaseFirestore</a></p><h4>Further Reading</h4><p><a href="https://javascript.plainenglish.io/how-to-build-a-decentralized-ecommerce-platform-with-react-and-solidity-part-two-cb4650f827b3">How To Build A Decentralized eCommerce Platform with React and Solidity</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79063adebab9" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/how-to-create-an-app-with-firebase-and-angular-part-2-79063adebab9">How to create an eCommerce app with Angular and Firebase: Part 2</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create an eCommerce app with Angular and Firebase: Part 1]]></title>
            <link>https://javascript.plainenglish.io/how-to-create-an-app-using-angular-and-firebase-part-1-debb80f928ad?source=rss-498df5be204------2</link>
            <guid isPermaLink="false">https://medium.com/p/debb80f928ad</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Nikhil Bhandarkar]]></dc:creator>
            <pubDate>Sat, 23 Feb 2019 15:55:05 GMT</pubDate>
            <atom:updated>2019-03-28T10:52:26.956Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to create an ecommerce web app with Angular and Firebase (Cloud Firestore)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_p-xSamqef71sErIbqhJlA.png" /></figure><h3>What you need:</h3><ul><li><strong>Node.js</strong></li><li><strong>NPM</strong></li></ul><p>If you have these both installed then great. If not, visit <a href="https://nodejs.org/en/">https://nodejs.org/en/</a> and install Node (npm is included by default, so there’s no need to install both separately).</p><ul><li><strong>Angular CLI (Command Line Interface).</strong></li></ul><p>Once you have installed Node and npm, you will be able to install Angular CLI by running the following in your terminal/command line:</p><pre><strong>npm i -g @angular/cli</strong></pre><p>Make sure you get its latest version. Learn more about Angular CLI <a href="https://cli.angular.io/">here</a>.</p><ul><li><strong>JavaScript/TypeScript basics.</strong></li><li><strong>Bootstrap basics.</strong></li></ul><h4>Do I need to know TypeScript?</h4><p><strong>Using TypeScript</strong> with <strong>Angular</strong> provides a seamless experience. However, you can still write regular vanilla JavaScript inside of your TypeScript files and they will work as normal.</p><p>Now that we have our environment ready, let’s proceed.</p><h3>Let’s get started</h3><p>Angular CLI is used to generate components, services, pipes, routes and directives.</p><p>To create a new angular application type below command:</p><pre>ng new ngCart --routing</pre><p>Here ngCart is our application’s name, above command will create a folder with name ngCart and make all the necessary files for us.</p><p>The --routing flag is used to generate <strong>app-routing.module.ts</strong> file which will contain all the information about routes.</p><blockquote><strong>“.ts”</strong> is the extension used for TypeScript files.</blockquote><h3>This is the file structure we get after running above command</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/1*xA8Sh-ltfCxaj7xz0B65bQ.png" /></figure><p>Don’t freak out, I know there are a lot of files. But we mostly will be working in <strong>src/app/ </strong>directory.</p><p><strong>app.component.css</strong> will contain all the CSS for the <strong>app</strong> component.</p><p><strong>app.component.html</strong> will contain all the HTML for the <strong>app</strong> component.</p><p><strong>app.component.ts</strong> will contain all the logic related to the <strong>app</strong> component.</p><p><strong>app.module.ts </strong>will take care of all the <strong>packages </strong>used in our app.</p><p>To achieve a great look we’ll use Bootstrap 4. Include the <a href="https://getbootstrap.com/docs/4.0/getting-started/download/">Bootstrap </a>CDN for CSS in index.html file before &lt;/head&gt;</p><pre>&lt;link rel=&quot;stylesheet&quot; href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css&quot; integrity=&quot;sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm&quot; crossorigin=&quot;anonymous&quot;&gt;</pre><p>Include <a href="https://getbootstrap.com/docs/4.0/getting-started/download/">Bootstrap</a> CDN for JS in index.html file before &lt;/body&gt;</p><pre>&lt;script src=&quot;https://code.jquery.com/jquery-3.2.1.slim.min.js&quot; integrity=&quot;sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;</pre><pre>&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js&quot; integrity=&quot;sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;</pre><pre>&lt;script src=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js&quot; integrity=&quot;sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;</pre><p>Now get into the root directory of your application, and type below command to run your app.</p><pre>ng serve -o</pre><p>The “<strong>- o</strong>” flag opens our app in the browser.</p><h3>Our app so far looks like this</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/1*09Gn6OGVHIhnFEG-z2YzQw.png" /></figure><p>If you see something like this opened in your browser then congratulation you just created an angular application.</p><p>But this is not what we want.</p><p>So let’s make some components required for the project.</p><h3>First we need to create the following file structure</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/202/1*bn5QDcWP7m1rMUgjRPkuog.png" /><figcaption>Component structure</figcaption></figure><h3>Execute below commands to generate components.</h3><p>Make sure you are in the root (/ngCart) folder of your application</p><pre>ng generate component Admin</pre><p>This command will generate 4 files and will update ‘app.module.ts’ file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*XSJDYDx4ijmTwJl52Ua32A.png" /><figcaption>ng g c component</figcaption></figure><p>To generate sub-components get into the folder of parent component and run commands as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*JLln15m8ELDpdwedIUokVg.png" /></figure><p>Now we will also generate <strong>services</strong> folder, in which we’ll generate ‘cart-service’ using below command.</p><pre>ng generage service cart</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*Y8lOHxVTvPe6ilkDWfaiHw.png" /></figure><p>Now generate UserComponent as shown in below picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*wivRmG6Pqd9mfhf9ShfYkw.png" /></figure><p>Now we are done with generating components, let’s import them in <strong>app.module.ts</strong> file. As we can see Angular CLI already imports all the components for us, so we only need to import services.</p><p>And don’t forget to include service names into the providers array.</p><p>Now let’s make some routes, for that we need to update <strong>app-routing.module.ts</strong>. Just copy all the import statements of components from <strong>app.module.ts</strong> file into <strong>app-routing.module.ts</strong> file.</p><pre>import { AppComponent } from ‘./app.component’;<br>import { AdminComponent } from ‘./admin/admin.component’;<br>import { AdminProductsComponent } from ‘./admin/admin-products/admin-products.component’;<br>import { AdminUsersComponent } from ‘./admin/admin-users/admin-users.component’;<br>import { ProductsComponent } from ‘./products/products.component’;<br>import { CartComponent } from ‘./products/cart/cart.component’;<br>import { UserComponent } from ‘./user/user.component’;<br>import { SignInComponent } from ‘./user/sign-in/sign-in.component’;<br>import { SignUpComponent } from ‘./user/sign-up/sign-up.component’;</pre><p>Paste below code before @NgModule keyword.</p><pre>const routes: Routes = [</pre><pre>{ path: &#39;&#39;, component: UserComponent},<br> { path: &#39;user&#39;, component: UserComponent,<br>     children: [<br>       { path: &#39;&#39;, component: SignInComponent },<br>       { path: &#39;signin&#39;, component: SignInComponent},<br>       { path: &#39;signup&#39;, component: SignUpComponent}<br>     ]<br> },<br> { path: &#39;products&#39;, component: ProductsComponent,<br>  children: [<br>       { path: &#39;cart&#39;, component: CartComponent }     ]<br> },<br> { path: &#39;admin&#39;, component: AdminComponent,<br>  children: [<br>       { path: &#39;products&#39;, component: AdminProductsComponent },<br>       { path: &#39;users&#39;, component: AdminUsersComponent }<br>     ]<br> }</pre><pre>];</pre><p>The above code sets up all of our routing.</p><p>Here parent components are UserComponent, ProductsComponent and AdminComponent.</p><p>So edit <strong>user.component.html, products.component.html and admin.component.html</strong> files and <strong>append</strong> below code.</p><pre>&lt;router-outlet&gt;&lt;/router-outlet&gt;</pre><p>Also, edit <strong>app.component.html, </strong>erase all the code and paste below code.</p><pre>&lt;router-outlet&gt;&lt;/router-outlet&gt;</pre><p>Now finally we are done with all the setup we need to make an application.</p><p>So let’s try visiting some routes from our application.</p><p>just type below command in CMD or Terminal.</p><pre>ng serve -o</pre><p>Your browser window will open and you will get something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*1DoKVHk7JCWYdpJSYWqiTw.png" /></figure><p>Go ahead and try all of your route urls to see if everything is set up. If so, you should be able to see the following things for each route:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*okBRfpqcjD46Pbq_xuJ8pw.png" /><figcaption>/user</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*9Is4RHTZ80t3J8uU00DLRw.png" /><figcaption>/user/signin</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*90zGU6rD-rVRSuuHS8O76g.png" /><figcaption>/user/signup</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*K3sYdatwwQPcQw6yaSf7Qw.png" /><figcaption>/admin</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*9QSn5JQvbNPHfSPEdlQCgQ.png" /><figcaption>/admin/products</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*G_of4aXB2sQ_zhbvWT-VnQ.png" /><figcaption>/admin/users</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*5jssQTGF-UZZ4h3o8Y9nNg.png" /><figcaption>/products</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*lcy2tAjZ8KzUJO8dhNuBdw.png" /><figcaption>/cart</figcaption></figure><h4>And there we have it!</h4><p>We’ve set up a new Angular application and have created the initial file structure and routing. In the next part we will supercharge our Angular app by connecting it to Firebase.</p><p>Happy coding!</p><h4>Thank you for your interest. Let me know your thoughts and please feel free to reach out if you have any questions 👍</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=debb80f928ad" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/how-to-create-an-app-using-angular-and-firebase-part-1-debb80f928ad">How to create an eCommerce app with Angular and Firebase: Part 1</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create E-Commerce application using Angular and Firebase Cloud Firestore — Part 2]]></title>
            <link>https://medium.com/@nikhil_bhandarkar/how-to-create-e-commerce-application-using-angular-and-firebase-cloud-firestore-part-2-63e4bf763226?source=rss-498df5be204------2</link>
            <guid isPermaLink="false">https://medium.com/p/63e4bf763226</guid>
            <category><![CDATA[angular2]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[web]]></category>
            <dc:creator><![CDATA[Nikhil Bhandarkar]]></dc:creator>
            <pubDate>Tue, 11 Dec 2018 07:35:22 GMT</pubDate>
            <atom:updated>2019-02-20T06:00:15.445Z</atom:updated>
            <content:encoded><![CDATA[<h3>Firebase with Angular, retrieving data (How to create E-Commerce application using Angular and Firebase Cloud Firestore ) — Part 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pBfSdC08wSsX8uSqMdzx4Q.jpeg" /><figcaption>I don’t hold any copyrights of this photo.. please don’t sue me</figcaption></figure><p>In the <a href="https://medium.com/@nikhilbhandarkar1998/how-to-create-e-commerce-application-using-angular-and-firebase-cloud-firestore-part-1-f4e2cba38a34">first part</a> we developed a basic angular application. Which was only displaying some text like ‘some-shit works!’ on respective route.</p><p>Now in this part, we are gonna connect our application with our database which is Firebase Cloud Firestore.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*KP_lg7YV4bySD2eWcVsxoA.png" /><figcaption>Firebase Cloud Firestore + Angular</figcaption></figure><p>To get started just head over to <a href="http://console.firebase.google.com/"><strong>console.firebase.google.com</strong></a><strong> </strong>login with your Google credentials.</p><p>Create a new Firebase app on your Firebase console by clicking on “Add project” and type any suitable name for your project. I am gonna name it ‘ngCart’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IXjMkMR5qGJ3gGDSn2x5fA.png" /><figcaption>Click on Add Project button.</figcaption></figure><p>This is how we will get a Firebase application.</p><p>Now visit the <a href="http://console.cloud.google.com/apis/library">Google Cloud Console</a> and select the project to add the Google Cloud Firestore API to the library.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aZ9bUpsm9S7BLfVowjdt7g.png" /><figcaption>search for api</figcaption></figure><p>Click on enable <strong>API</strong> for our created project.</p><p>Get credentials by clicking on create credentials button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*naVOnppE3gKcx4LJDWA4og.jpeg" /><figcaption>Create Credentials</figcaption></figure><p>It asks which API you are using</p><p>Select Cloud Firestore API from a dropdown, we don’t need any special credentials to default credentials will work for us.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_rNCaGqfK_j1SFFEjXNCXg.jpeg" /><figcaption>Add Credentials</figcaption></figure><p>Now head over to <strong>Firebase console</strong> -&gt; <strong>Database</strong> and click on <strong>Cloud Firestore.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IpUBK1-Fidw2KSbkPu7UjQ.jpeg" /></figure><p><strong>Click on create database</strong> -&gt; <strong>start in test mode</strong> -&gt; <strong>Enable</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lhMPPvaQZ3DVFd5sEQDYLw.jpeg" /><figcaption>Enable rules</figcaption></figure><p>So we are done with creating our database and ready to connect our application with the database we have been setting up.</p><p>Click on <strong>Project Overview</strong> present on the top left corner of your <strong>Firebase</strong> console</p><p>Click on that <strong>&lt;/&gt;</strong>icon.</p><p>Copy whatever is there in those curly braces.</p><p>Open <strong>‘src/environments/environment.ts’</strong> file in any code editor.</p><p>Your <strong>environment.ts</strong> file should look like this,</p><pre>//src/environments/environment.ts</pre><pre>export const environment = {<br>  production: false,<br>  firebase: {<br>   apiKey: &quot;*****************************************&quot;,<br>    authDomain: &quot;app-***.firebaseapp.com&quot;,<br>    databaseURL: &quot;<a href="https://ngcart-58f8b.firebaseio.com/">https://*********.firebaseio.com</a>&quot;,<br>    projectId: &quot;<a href="https://ngcart-58f8b.firebaseio.com/">*********</a>&quot;,<br>    storageBucket: &quot;<a href="https://ngcart-58f8b.firebaseio.com/">*********</a>.appspot.com&quot;,<br>    messagingSenderId: &quot;<a href="https://ngcart-58f8b.firebaseio.com/">*********</a>&quot;<br>  }<br>};</pre><p>Import <strong>environment.ts</strong> file in <strong>app.module.ts</strong>, just add below line after all imports</p><pre>import { environment } from &#39;../environments/environment&#39;;</pre><p>Now let’s import the module that comes with the Angular library for Firebase/Cloud Firestore. Run below command in the parent directory of your application.</p><pre>npm install <a href="http://twitter.com/angular/fire">@angular/fire</a> firebase --save</pre><p>Import following module in <strong>‘app.module.ts’</strong> file</p><pre>//app.module.ts<br>import { AngularFireModule } from &#39;<a href="http://twitter.com/angular/fire">@angular/fire</a>&#39;;<br>import { AngularFirestore } from &#39;<a href="http://twitter.com/angular/fire">@angular/fire</a>/firestore&#39;;<br>import { AngularFirestoreModule } from &#39;<a href="http://twitter.com/angular/fire">@angular/fire</a>/firestore&#39;;</pre><p>Append <strong>Imports</strong> array in <strong>‘app.module.ts’</strong> file</p><pre>//app.module.ts<br>imports: [<br>    BrowserModule,<br>    HttpClientModule,<br>    AppRoutingModule,<br>    AngularFireModule.initializeApp(environment.firebase),<br>    AngularFirestoreModule<br>  ],</pre><p>So finally we are done with connecting database with our application.</p><p>Let’s add some data to our database so that we can fetch.</p><p>Go to your <strong>Firebase Console </strong>-&gt;<strong> Database </strong>-&gt;<strong>Add Collection</strong></p><p>And type the name of your collection as items, as we are building e-commerce like the application we will need items to list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ei9XmJiYKKX8vnFaeTBzQ.png" /><figcaption>Add Collection</figcaption></figure><p>Create some random data to work on, like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yq77lCEN0iBy0XasE5EDNw.png" /></figure><p>Now we will modify our <strong>‘/src/app/products/products.component.ts’ </strong>and import observable along with the code to fetch data from the database.</p><p>Data will be returned as an observable, hence we need to create an observable ‘items: Observable&lt;any[]&gt;’ its datatype is ‘any’ so that it can have any sort of data.</p><pre>// src/app/products/products.component.ts</pre><pre>import { Component, OnInit } from &#39;<a href="http://twitter.com/angular/core">@angular/core</a>&#39;;<br>import { AngularFirestore } from &#39;@angular/fire/firestore&#39;;<br>import { Observable } from &#39;rxjs&#39;;</pre><pre><a href="http://twitter.com/Component">@Component</a>({<br>  selector: &#39;app-products&#39;,<br>  templateUrl: &#39;./products.component.html&#39;,<br>  styleUrls: [&#39;./products.component.css&#39;]<br>})<br>export class ProductsComponent implements OnInit {</pre><pre>items: Observable&lt;any[]&gt;;<br>  <br>  constructor(db: AngularFirestore) {<br>    this.items = db.collection(&#39;items&#39;).valueChanges();<br>  }</pre><pre>ngOnInit() {<br>  }</pre><pre>}</pre><p>Then we will write some code in the constructor, so that it gets executed on the component creation.</p><blockquote>Here is the link to official <a href="https://github.com/angular/angularfire2"><strong>Angular +Firebase Documentation</strong></a></blockquote><p>Now let’s create some frontend thing to show what we’ve got in our database, just append below code to <strong>‘/src/app/products/products.component.html’</strong></p><pre>// src/app/products/products.component.html</pre><pre>&lt;p&gt;<br>  products works!<br>&lt;/p&gt;<br>&lt;router-outlet&gt;&lt;/router-outlet&gt;</pre><pre>&lt;ul&gt;<br> &lt;li *ngFor=&quot;let item of items | async&quot;&gt;<br>   &lt;h1&gt;{{ item.productName }}&lt;/h1&gt;<br>   {{ item.price }}<br> &lt;/li&gt;<br>&lt;/ul&gt;</pre><p>Finally, we are done and I hope this should work. Just serve your application from your parent directory by running below command,</p><pre>ng s -o</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pOJ4OPs4oPeeoeCR5b7GGQ.png" /></figure><h3>If something like above shows up, congrats we’ve done it.</h3><p>I love barney :p</p><p><strong>This is it ;) for this part, in the next part we will style our application using bootstrap 4. Until then get your application up and running.</strong></p><blockquote>Angular is easier than you think. Angular is one of the best JavaScript libraries, and it has great support and a nice community. It also has tools that make working with Angular fast and easy, like the one we used Angular CLI.</blockquote><p><strong>Share this post with those who are struggling with angular 2.x &lt; and help them get started, it’ll be a great help for them.</strong></p><p>Happy coding.</p><h4>Thanks for your interest. Let me know your thoughts. I’m always glad to get feedback. And also comment if you have any query.</h4><p><strong>Here is the link to the Angular 2.X course :</strong></p><ul><li><a href="https://coursetro.com/courses/8/Learn-Angular-2-Development-with-our-Free-Course"><strong>learn Angular2 (coursetro</strong></a><strong>)</strong></li></ul><p><strong>Follow me on </strong><a href="https://www.instagram.com/_whatifi/"><strong>Instagram (@_whatifi)</strong></a><strong> I also like making magic videos.</strong></p><p>I am so Done</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63e4bf763226" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic Angular setup and Component structure (How to create E-Commerce application using Angular and…]]></title>
            <link>https://medium.com/@nikhil_bhandarkar/how-to-create-e-commerce-application-using-angular-and-firebase-cloud-firestore-part-1-f4e2cba38a34?source=rss-498df5be204------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4e2cba38a34</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[angularjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Nikhil Bhandarkar]]></dc:creator>
            <pubDate>Wed, 27 Jun 2018 08:08:22 GMT</pubDate>
            <atom:updated>2019-02-20T06:03:50.845Z</atom:updated>
            <content:encoded><![CDATA[<h3>Basic Angular setup and Component structure (How to create E-Commerce application using Angular and Firebase Cloud Firestore) — Part 1</h3><p><strong>Angular</strong> is a <strong>TypeScript </strong>based open-source front-end web application platform led by the <strong>Angular</strong> Team at Google.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*1wHHwU7cakJ0BvfkPmRzcA.png" /></figure><blockquote>Angular JS and Angular are totally different. If you don’t have any Idea about Angular JS ( or Angular 1.x ) don’t worry I too never worked with it. Angular 2 and the former versions are pretty simpler than Angular 1.x, we are good to go.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*W6UtaT3IUK1ket1ITUCRTQ.jpeg" /></figure><h3>What you probably need:</h3><ul><li><strong>Node.js</strong></li></ul><p>Check if <a href="https://nodejs.org/en/download/"><strong>Node.js</strong></a> is installed.</p><ul><li><strong>NPM</strong></li></ul><p>Check if <a href="https://www.npmjs.com/"><strong>NPM </strong></a>(Node Package Manager) is installed</p><p>Check Node.js and NPM version :</p><pre><strong>node -v</strong></pre><pre><strong>npm -v</strong></pre><ul><li><strong>Install Angular CLI ( Command Line Interface) :</strong></li></ul><pre><strong>npm i -g @angular/cli</strong></pre><p>Make sure you get its latest version. Learn more about Angular CLI <a href="https://cli.angular.io/">here</a>.</p><ul><li><strong>JavaScript basics.</strong></li><li><strong>Bootstrap basics.</strong></li></ul><p><strong>Angular</strong> is a framework built entirely in <strong>TypeScript. Using TypeScript</strong> with <strong>Angular</strong> provides a seamless experience. The <strong>Angular</strong> documentation not only supports <strong>TypeScript</strong> as a first-class citizen but uses it as its primary language.</p><p>But don’t worry TypeScript is pretty much similar to JavaScript. If you are familiar with JavaScript, you are golden.</p><p>Now that we have our environment ready, let’s proceed.</p><h3>Let’s get started</h3><p>Angular CLI is used to generate components, services, pipes, routes and directives.</p><p>to create a new angular application type below command :</p><pre>ng new ngCart --routing</pre><p>Here ngCart is our applications name, above command will create a folder with name ngCart and make all the necessary files for us.</p><p>— routing flag is used to generate <strong>app-routing.module.ts</strong> file which will contain all the information about routes.</p><blockquote><strong>“.ts”</strong> is extension used for TypeScript files.</blockquote><h3><strong>This is the file structure we get after running above command</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/1*xA8Sh-ltfCxaj7xz0B65bQ.png" /></figure><p>Don’t freak out, I know there are a lot of files. But we mostly will be working in <strong>src/app/ </strong>directory.</p><p><strong>app.component.css</strong> will contain all the CSS for the <strong>app</strong> component.</p><p><strong>app.component.html</strong> will contain all the HTML for the <strong>app</strong> component.</p><p><strong>app.component.ts</strong> will contain all the logic related to the <strong>app</strong> component.</p><p><strong>app.module.ts </strong>will take care of all the <strong>packages </strong>used in our app.</p><p>To achieve a great look we’ll use Bootstrap 4.</p><p>Include B<a href="https://getbootstrap.com/docs/4.0/getting-started/download/">ootstrap </a>CDN for CSS in index.html file before &lt;/head&gt;</p><pre>&lt;link rel=&quot;stylesheet&quot; href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css&quot; integrity=&quot;sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm&quot; crossorigin=&quot;anonymous&quot;&gt;</pre><p>Include <a href="https://getbootstrap.com/docs/4.0/getting-started/download/">Bootstrap</a> CDN for JS in index.html file before &lt;/body&gt;</p><pre>&lt;script src=&quot;https://code.jquery.com/jquery-3.2.1.slim.min.js&quot; integrity=&quot;sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;</pre><pre>&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js&quot; integrity=&quot;sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;</pre><pre>&lt;script src=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js&quot; integrity=&quot;sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;</pre><p>Now get into the root directory of your application, and type below command to run your app.</p><pre>ng s -o</pre><p>“<strong>- o</strong>” flag opens our app in the browser.</p><h3>Basic application ready</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/1*09Gn6OGVHIhnFEG-z2YzQw.png" /></figure><p>If you see something like this opened in your browser then congratulation you just created an angular application.</p><p>But this is not what we want.</p><p>So let&#39;s make some components required for the project.</p><h3>Our component structure is shown in below picture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/202/1*bn5QDcWP7m1rMUgjRPkuog.png" /><figcaption>Component structure</figcaption></figure><h3>Execute below commands to generate components.</h3><p>Make sure you are in the root (/ngCart) folder of your application</p><pre>ng g c Admin</pre><p>This command will generate 4 files and will update ‘app.module.ts’ file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*XSJDYDx4ijmTwJl52Ua32A.png" /><figcaption>ng g c component</figcaption></figure><p>To generate sub-components get into the folder of parent component and run commands as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*JLln15m8ELDpdwedIUokVg.png" /></figure><p>Now we will also generate ‘/services’ folder, in which we’ll generate ‘cart-service’ using below command.</p><pre>ng g service cart</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*Y8lOHxVTvPe6ilkDWfaiHw.png" /></figure><p>Now generate UserComponent as shown in below picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*wivRmG6Pqd9mfhf9ShfYkw.png" /></figure><p>Now we are done with generating components, let&#39;s import them in ‘app.module.ts’ file. As we can see Angular CLI already imports all the components for us, so we only need to import services.</p><p>And don’t forget to include service names into the ‘providers’ array.</p><p>Now let’s make some routes, for that we need to update ‘app-routing.module.ts’. Just copy all the import statements of components from ‘app.module.ts’ file into ‘app-routing.module.ts’ file.</p><pre>import { AppComponent } from ‘./app.component’;<br>import { AdminComponent } from ‘./admin/admin.component’;<br>import { AdminProductsComponent } from ‘./admin/admin-products/admin-products.component’;<br>import { AdminUsersComponent } from ‘./admin/admin-users/admin-users.component’;<br>import { ProductsComponent } from ‘./products/products.component’;<br>import { CartComponent } from ‘./products/cart/cart.component’;<br>import { UserComponent } from ‘./user/user.component’;<br>import { SignInComponent } from ‘./user/sign-in/sign-in.component’;<br>import { SignUpComponent } from ‘./user/sign-up/sign-up.component’;</pre><p>Paste below code before ‘@NgModule’ keyword.</p><pre>const routes: Routes = [</pre><pre>{ path: &#39;&#39;, component: UserComponent},<br> { path: &#39;user&#39;, component: UserComponent,<br>     children: [<br>       { path: &#39;&#39;, component: SignInComponent },<br>       { path: &#39;signin&#39;, component: SignInComponent},<br>       { path: &#39;signup&#39;, component: SignUpComponent}<br>     ]<br> },<br> { path: &#39;products&#39;, component: ProductsComponent,<br>  children: [<br>       { path: &#39;cart&#39;, component: CartComponent }     ]<br> },<br> { path: &#39;admin&#39;, component: AdminComponent,<br>  children: [<br>       { path: &#39;products&#39;, component: AdminProductsComponent },<br>       { path: &#39;users&#39;, component: AdminUsersComponent }<br>     ]<br> }</pre><pre>];</pre><p>Above code is pretty simple, you can get the idea about routes.</p><p>Here parent components are UserComponent, ProductsComponent and AdminComponent.</p><p>So edit <strong>user.component.html, products.component.html and admin.component.html</strong> files and <strong>append</strong> below code.</p><pre>&lt;router-outlet&gt;&lt;/router-outlet&gt;</pre><p>Also, edit <strong>app.component.html, </strong>erase all the code and paste below code.</p><pre>&lt;router-outlet&gt;&lt;/router-outlet&gt;</pre><p>Now finally we are done with all the setup we need to make an application.</p><p>So let’s try visiting some routes from our application.</p><p>just type below command in CMD or Terminal.</p><pre>ng s -o</pre><p>Your browser window will open and you will get something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*1DoKVHk7JCWYdpJSYWqiTw.png" /></figure><p>Try all possible routes like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*okBRfpqcjD46Pbq_xuJ8pw.png" /><figcaption>/user</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*9Is4RHTZ80t3J8uU00DLRw.png" /><figcaption>/user/signin</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*90zGU6rD-rVRSuuHS8O76g.png" /><figcaption>/user/signup</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*K3sYdatwwQPcQw6yaSf7Qw.png" /><figcaption>/admin</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*9QSn5JQvbNPHfSPEdlQCgQ.png" /><figcaption>/admin/products</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*G_of4aXB2sQ_zhbvWT-VnQ.png" /><figcaption>/admin/users</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*5jssQTGF-UZZ4h3o8Y9nNg.png" /><figcaption>/products</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*lcy2tAjZ8KzUJO8dhNuBdw.png" /><figcaption>/cart</figcaption></figure><p><strong>This is it ;) for this part, in the next part we will style our application using bootstrap 4. Until then get your application up and running.</strong></p><blockquote>Angular is easier than you think. Angular is one of the best JavaScript libraries, and it has great support and a nice community. It also has tools that make working with Angular fast and easy, like the one we used Angular CLI.</blockquote><p><strong>Share this post with those who are struggling with angular 2 and help them get started, it’ll be a great help for them.</strong></p><p>Happy coding.</p><h4>Thanks for your interest. Let me know your thoughts. I’m always glad to get feedback. <strong>And also comment if you have any query.</strong></h4><p><strong>Here is the link to the Angular 2.X course :</strong></p><ul><li><a href="https://coursetro.com/courses/8/Learn-Angular-2-Development-with-our-Free-Course"><strong>learn Angular2 (coursetro</strong></a><strong>)</strong></li></ul><p><strong>Follow me on </strong><a href="https://www.instagram.com/_whatifi/"><strong>Instagram (@_whatifi)</strong></a><strong> I also like making magic videos.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4e2cba38a34" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>