<?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 Sarthak Srivastav on Medium]]></title>
        <description><![CDATA[Stories by Sarthak Srivastav on Medium]]></description>
        <link>https://medium.com/@sarthaksrivastav?source=rss-88c8d2541946------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wz2vNikCDSbs8by-34s7Jg.jpeg</url>
            <title>Stories by Sarthak Srivastav on Medium</title>
            <link>https://medium.com/@sarthaksrivastav?source=rss-88c8d2541946------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 12:21:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sarthaksrivastav/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[Closures in Javascript]]></title>
            <link>https://tech.groww.in/closures-in-javascript-7e66eb8b9464?source=rss-88c8d2541946------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e66eb8b9464</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[closure]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[code]]></category>
            <dc:creator><![CDATA[Sarthak Srivastav]]></dc:creator>
            <pubDate>Fri, 22 Apr 2022 05:28:18 GMT</pubDate>
            <atom:updated>2025-04-21T07:03:59.504Z</atom:updated>
            <content:encoded><![CDATA[<h3>Let’s do a closure on “closures” in javascript</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tknlEXuqF4rO5fGU" /><figcaption>Photo by <a href="https://unsplash.com/@goshua13?utm_source=medium&amp;utm_medium=referral">Joshua Aragon</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The concept of closures is extremely important in the realm of javascript. Sometimes we enjoy the benefits of closures in javascript without even realizing it and due to this many of us either ignore or don’t fully understand this concept.</p><p>In this article, we will first try to learn what exactly closure is. Then, we will go through a series of code examples to test our knowledge in and out.</p><h4><strong>What is closure?</strong></h4><pre>function outer (){<br>  let counter = 0;</pre><pre>  function inner (){<br>    console.log(counter);<br>  }</pre><pre>  inner();<br>}</pre><pre>outer();</pre><p>Raise your hand if you have seen a similar example like this for explaining closures. I used to think like what’s the big deal here? We have defined a variable and can access it inside a function defined after it. But, check this one now.</p><pre>function outer() {<br>  let counter = 0;</pre><pre>  function inner() {<br>    console.log(counter);<br>  }</pre><pre>  return inner;<br>}</pre><pre>function execute() {<br>  const inner = outer();</pre><pre>  inner();<br>}</pre><pre>execute();</pre><p>Now, here we have called the inner method in some other function. Still, we get output as 0. It is as if whenever we call this inner method, it remembers the counter variable.</p><p>I was watching a video of codesmith on closures and they made a nice analogy on closures with a backpack. The thing is that when we return a function from another function we don’t get the function only. <br>We get a backpack that contains the local variables along with the function.</p><p>Enough theory. Let’s get to the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*cye_Zz1LPnbTIN8J" /></figure><p>We will take 1 example and modify it several times. I hope that will solidify the concept for us.</p><h4>Example 1.1:</h4><pre>function outer (){<br>  let counter = 0;</pre><pre>  function incrementCounter (){<br>    counter++;<br>    console.log(counter);<br>  }</pre><pre>  return incrementCounter;<br>}</pre><pre>const myNewFunction = outer();</pre><pre>myNewFunction();<br>myNewFunction();</pre><p>Based on the above learnings what do you think would be the output here. Thinking through the backpack analogy, myNewFunction will be in a backpack with the variable counter. It has lifetime access to it so the result of this code should be: 1 2</p><h4>Example 1.2:</h4><pre>function outer (){<br>  let counter = 0;</pre><pre>  function incrementCounter (){<br>      counter++;<br>      console.log(counter);<br>  }</pre><pre>  return incrementCounter;<br>}</pre><pre>const myNewFunction = outer();</pre><pre>myNewFunction();</pre><pre>const myOtherNewFunction = outer();</pre><pre>myOtherNewFunction();</pre><p>How about this one? Here myOtherNewFunction is a whole new copy of incrementCounter and has nothing to do with myNewFunction. So, the output should be: 1 1</p><h4>Example 1.3:</h4><pre>function outer (){<br>  let counter = 0;</pre><pre>  function incrementCounter (){<br>    counter++;<br>  }</pre><pre>  let currentCount = `Count is ${counter}`;</pre><pre>  function getCurrentCount() {<br>    console.log(currentCount);<br>  }</pre><pre>  return [incrementCounter,getCurrentCount];<br>}</pre><pre>const [incrementCounter,getCurrentCount] = outer();</pre><pre>incrementCounter();<br>incrementCounter();<br>incrementCounter();</pre><pre>getCurrentCount();</pre><p>Here, we have called incrementCounter 3 times thus increasing the value of counter to 3. So what should be the output when getCurrentCount is called?</p><p>You are right, It will be Count is 0. Even if the counter variable is increased several times the currentCount variable always holds the value Count is 0. getCurrentCount function is a closure that captures currentCountvariable from the outer() scope.</p><h4>Example 1.4:</h4><p>Here, we will try to get the output as the anticipated one i.e. Count is 3 with some slight changes. Before going forward, copy-paste the above code in your console and try modifying it on your own first.</p><p>The problem in the example 1.3 was that currentCount was defined when outer was called so getCurrentCount function has Count is 0 only in its closure. <br>What if we could define that currentCount variable when getCurrentCount is called. In that case, we can get the latest counter value i.e. 3.</p><pre>function outer (){<br>  let counter = 0;</pre><pre>  function incrementCounter (){<br>    counter++;<br>  }</pre><pre>  function getCurrentCount() {<br>    let currentCount = `Count is ${counter}`;</pre><pre>    console.log(currentCount);<br>  }</pre><pre>  return [incrementCounter,getCurrentCount];<br>}</pre><pre>const [incrementCounter,getCurrentCount] = outer();</pre><pre>incrementCounter();<br>incrementCounter();<br>incrementCounter();</pre><pre>getCurrentCount();</pre><h4><strong>Clos(ur)ing remarks</strong></h4><p>There is a high chance that you might have used closures in your existing code. Let’s try to go through it and identify the use of closures in them. Do give a thought to what if we wanted to do the same thing but without closures. Is that even possible?</p><p>If you’ve enjoyed this story, please click the 👏 button and share it, so that others can find it as well! Also, feel free to leave a comment below.</p><p>Groww Engineering publishes technical anecdotes, the latest technologies, and better ways to tackle common programming problems. You can <a href="https://medium.com/groww-engineering">subscribe here</a> to get the latest updates.</p><p>We are hiring. View job openings <a href="https://groww.in/careers">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e66eb8b9464" width="1" height="1" alt=""><hr><p><a href="https://tech.groww.in/closures-in-javascript-7e66eb8b9464">Closures in Javascript</a> was originally published in <a href="https://tech.groww.in/">The Groww Engineering Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[6 tips to enhance your website’s Search UX]]></title>
            <link>https://tech.groww.in/6-tips-to-enhance-your-websites-search-ux-646e24a3cfb9?source=rss-88c8d2541946------2</link>
            <guid isPermaLink="false">https://medium.com/p/646e24a3cfb9</guid>
            <category><![CDATA[ux-research]]></category>
            <category><![CDATA[search]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Sarthak Srivastav]]></dc:creator>
            <pubDate>Sun, 13 Feb 2022 21:36:12 GMT</pubDate>
            <atom:updated>2025-04-21T07:27:51.441Z</atom:updated>
            <content:encoded><![CDATA[<h3>6 tips to improve the Search Experience on your website</h3><h4>Helping users find what they’re looking for in a better way.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*wUlHNAk0zoIpyzWCEo07zA.jpeg" /><figcaption>A user trying hard to search on our websites</figcaption></figure><p>The search interface is probably the first thing a user interacts with on a site. Optimizing the functionality of the search feature leads to a positive user experience which in turn results in improvements in conversions, engagements, and user retentions.</p><p>In this blog post, we will be discussing some <strong>not so obvious search UX enhancements</strong> that can ease the user’s life and are not so difficult to implement as well. Mind you, these points are frontend driven and are to be included in your site once the feature is almost ready.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F7535412&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fsalt-bae-sprinkling-salt-gif-7535412&amp;image=https%3A%2F%2Fc.tenor.com%2FpTxgUHdLWAkAAAAC%2Fsalt-bae-sprinkling-salt.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/2757f2e1e55563cd244b273eb324ca35/href">https://medium.com/media/2757f2e1e55563cd244b273eb324ca35/href</a></iframe><h3>1. Search Progress</h3><p>We do want our searches to be lightning-fast but there will be cases when they won’t be fast enough.</p><p>At that time we need to give users visual feedback that the system is working. Showing a loader like in the gif attached can do the trick.</p><p>Now, one can think of adding some fancy animation, etc. too instead. It can also distract the user from slow search results.</p><p>Including a loader can help in improving the <a href="https://developer.mozilla.org/en-US/docs/Learn/Performance/Perceived_performance">perceived performance</a> as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*sdRuFcTKKKxfgXpnpoz7lA.gif" /><figcaption>Search Loader</figcaption></figure><h3>2. Add keyboard shortcuts</h3><p>To enter the search query a user has to use the keyboard. But to go on the desired suggestion and select it, the user has to switch to the mouse. <br>How about adding keyboard shortcuts for letting the user do the latter things with the keyboard as well?</p><ul><li>Arrow keys for navigating in between the suggestions.</li><li>Enter key to select a suggestion.</li><li>Escape key to close the suggestions.</li></ul><p>With the combination of all these, we can really make the search process fast for a user.</p><h3>3. Auto highlight the first suggestion.</h3><p>Most of the autocomplete search algorithms are designed to list out suggestions in decreasing order of their popularity.</p><p>So, counting on our search algorithm’s efficiency we can pre-highlight the first suggestion, and then the user just has to press enter to select it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*LjVw9ZsSty7fngGAKXGxuQ.gif" /><figcaption>Auto highlight first suggestion</figcaption></figure><p>In point 2, we discussed a user’s journey for searching through keyboard. Here, we dismissed one stage of that(using arrow keys to navigate to desired suggestion) based on a data-driven assumption. We can think of more such ways to help users reach their destinations even faster.</p><h3>4. Don’t erase user’s queries after they are finished with the search</h3><p>The simple idea is a user might not be satisfied with the result and there is a chance that he/she will come again on the search bar and search again. <br>The solution is to not delete the query even after the search is complete.</p><p>But, what if the user wanted to go with a new search query?<br>In that case, there is always a way to delete the whole query with the cross button provided (another good UX addition).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*IwM5OHDrHjRzhiJg6HqHVg.png" /></figure><h3>5. Allow opening the clicked suggestions in a new tab as well</h3><p>Have you ever used ctrl+click to open links in a new tab? Can you recall why you did so?</p><p>Let’s take an example of an e-commerce website. Many a time we have to compare products before buying.</p><ul><li>One way is to open the website, again and again, search our product and compare.</li><li>Or just search for our product once and open the suggestions in new tabs with ctrl+click.</li></ul><p>I guess the second one is better.</p><h3>6. A shortcut to focus on the search bar</h3><p>Suppose you are at the bottom of a webpage miles from the search bar. You press a key and you are scrolled at the top and the search bar is in a focus state for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rLpB_c3yMcZA6KIR5HlopA.png" /><figcaption>MDN search bar</figcaption></figure><p>Now, this can be really helpful for the users and a lot of sites are using this too like <a href="https://developer.mozilla.org/en-US/">M</a>DN, <a href="https://www.google.com/search?q=a">Google</a>, <a href="https://github.com/">GitHub</a>, Jira, etc. But, there are a few gotchas.</p><pre>document.addEventListener(&quot;keyup&quot;, e =&gt; {   <br>   if (e.code !== &quot;slash&quot;) return;   <br>      <br>   e.preventDefault();       <br>      <br>   document.getElementById(&quot;search&quot;).focus(); <br>});</pre><p>The above code listens for every keyup event and if that’s “/” then it focuses on the search. This will fulfill our use case but the issue is that it will focus on the search on every “/” press.</p><p>We need to carefully check all the use-cases where this “/” can be used and handle them. A few examples can be a form input where we need to type “/” or if some important popup is opened then we might not want this shortcut to work.</p><p>These were some UX enhancements we did recently on our website’s search. If you want to try them out please head over to our website <a href="https://groww.in/stocks/user/explore">https://groww.in</a>.</p><h3>Conclusion</h3><blockquote>“Simplicity is about subtracting the obvious and adding the meaningful.” — John Maeda</blockquote><p>The main goal of this blog post was to instigate thoughts on UX which is rather invisible but can enhance a user’s experience on our sites.</p><p>Please share similar examples from your sites. We would love to hear and discuss them.</p><p>Thank you!</p><p>If you enjoyed this story, please click the 👏 button and share to help others find it! Feel free to leave a comment below.</p><p>Groww Engineering publishes technical pieces, the latest knick-knacks in the coding world, and convenient ways to tackle common programming problems.</p><p>Read more of our articles <a href="https://tech.groww.in/">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=646e24a3cfb9" width="1" height="1" alt=""><hr><p><a href="https://tech.groww.in/6-tips-to-enhance-your-websites-search-ux-646e24a3cfb9">6 tips to enhance your website’s Search UX</a> was originally published in <a href="https://tech.groww.in/">The Groww Engineering Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the CSS z-index property.]]></title>
            <link>https://tech.groww.in/understanding-the-css-z-index-property-83dd58d991b4?source=rss-88c8d2541946------2</link>
            <guid isPermaLink="false">https://medium.com/p/83dd58d991b4</guid>
            <category><![CDATA[css-positioning]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[stacking-context]]></category>
            <category><![CDATA[z-index]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Sarthak Srivastav]]></dc:creator>
            <pubDate>Sun, 16 May 2021 19:12:35 GMT</pubDate>
            <atom:updated>2021-05-17T16:20:26.908Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>z-index property defines the stacking order</strong> for HTML elements on a page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5uUMIMZMllXr1fJq" /><figcaption>Photo by <a href="https://unsplash.com/@single_lens_reflex?utm_source=medium&amp;utm_medium=referral">Dan Burton</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Have you ever set a z-index value of 999999 for your element but still couldn’t manage to overlap that one other element. Let’s try to dig into this issue by getting a deeper understanding of the z-index.</p><h4>Why do we need z-index?</h4><p>You must have heard about the 3 axes (x,y,z) in the cartesian plate. Most of the time we try to reposition our HTML elements on the x and y axes of the page with CSS but sometimes when they start overlapping each other we need to set the order of elements on the z-axis. That’s when the z-index comes into play.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FSarthakSri%2Fembed%2Fpreview%2FVwpjmjo%3Fdefault-tabs%3Dcss%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DVwpjmjo&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2FSarthakSri%2Fpen%2FVwpjmjo&amp;image=https%3A%2F%2Fassets.codepen.io%2F1374032%2Finternal%2Fscreenshots%2Fpens%2FVwpjmjo.default.png%3Ffit%3Dcover%26format%3Dauto%26ha%3Dfalse%26height%3D540%26quality%3D75%26v%3D2%26version%3D1621192437%26width%3D960&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/0072db40921285c66dcb19d36a2ba00b/href">https://medium.com/media/0072db40921285c66dcb19d36a2ba00b/href</a></iframe><p>In the code above we have made 2 boxes and gave some -ve margins so that they can overlap with each other. We can see box1 is below box2. <br>This was expected and this is because they are following the <strong>Natural Stacking Order.</strong></p><h4>Natural Stacking Order</h4><p>The natural stacking order is a set of rules our elements follow to order themselves on the page vertically. Below are the levels sorted in ascending order for priority.</p><ul><li>Background and borders of the element(lowest priority)</li><li>Elements with negative stacking contexts, in order of appearance</li><li>Non-positioned, floated elements, in order of appearance</li><li>Inline elements, in order of appearance</li><li>Positioned elements, in order of appearance(highest priority)</li></ul><p>So, as per these rules, in the above codepen example, if you give <em>position: relative</em>(or any other position property except static) to box1 then it will come at the top of box2.</p><p>Now, since you have an idea about how elements are stacked together we can start on how z-index can help us tweak this natural stack according to our needs.</p><h4><strong>How does the z-index work?</strong></h4><blockquote>The <strong>z-index</strong> CSS property sets the z-order of a <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/position">positioned</a> element and its descendants or flex items. Overlapping elements with a larger z-index cover those with a smaller one.</blockquote><blockquote>- mdn docs</blockquote><p>So, according to this, the element with the largest z-index value will be at the top of the page. When I first read this I thought this was the simplest concept in CSS. However, if you remember the bug we discussed in the starting, this concept is not solving it.</p><blockquote>Why does a z-index value of 9999 can’t beat a lower z-index value sometimes?</blockquote><p>The answer is <strong>Stacking Context</strong>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F8776030&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fseriously-sideeye-confused-gif-8776030&amp;image=https%3A%2F%2Fmedia.tenor.com%2Fimages%2F405418bc405af5e546d80625d8526832%2Ftenor.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0c38ddcc0c6e616c12a4f2ba1252e07/href">https://medium.com/media/c0c38ddcc0c6e616c12a4f2ba1252e07/href</a></iframe><h4>Stacking Context</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FSarthakSri%2Fembed%2Fpreview%2FyLMJVwR%3Fdefault-tabs%3Dcss%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DyLMJVwR&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2FSarthakSri%2Fpen%2FyLMJVwR&amp;image=https%3A%2F%2Fassets.codepen.io%2F1374032%2Finternal%2Fscreenshots%2Fpens%2FyLMJVwR.default.png%3Ffit%3Dcover%26amp%3Bformat%3Dauto%26amp%3Bha%3Dfalse%26amp%3Bheight%3D360%26amp%3Bquality%3D75%26amp%3Bv%3D2%26amp%3Bversion%3D1621183638%26amp%3Bwidth%3D640&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/b954e146d0ceee7c3c5669110618a82b/href">https://medium.com/media/b954e146d0ceee7c3c5669110618a82b/href</a></iframe><p>This pen is just the opposite of the first one in terms of the order of the boxes. Let’s check the CSS.</p><pre>.box{<br>  height:100px;<br>  width:100px;<br>  text-align:center;<br>}</pre><pre>.box1{<br>  background:red;<br>  position:relative;<br>  z-index:2;<br>}</pre><pre>.secondBoxWrapper{<br>  position:relative;<br>  z-index:1;<br>}</pre><pre>.box2{<br>  background:yellow;<br>  position:relative;<br>  z-index:999999;<br>  margin: -50px 0 -50px 50px;<br>}</pre><p>We have given here a z-index value of 2 to box1 and 999999 to box2. But still, box1 is overlapping box2. This is a simplified version of the bug we discussed in the beginning.</p><p>By now, you might have noticed that the secondBoxWrapper class having <em>z-index:1 </em>might be the culprit behind all this and you are absolutely right.<br>Here, secondBoxWrapper is creating a <strong>Stacking Context </strong>in which there is only 1 element i.e. box2.</p><p>But, <strong>how did secondBoxWrapper created a new stacking context?</strong><br>It is because this time in the secondBoxWrapper class we have set position as relative and z-index as 1.</p><p><strong>Is there any other way to create these stacking contexts?<br></strong>Yes, there are multiple ways to create stacking contexts. A few of them are:</p><ul><li>Setting opacity to a value less than 1.</li><li>Setting position to relative/absolute and give the z-index some value.<br>(this is the one we used).</li><li>Setting position to fixed or sticky (No z-index needed for these values!).</li><li>Adding a z-index to a child inside a display: flex or display: grid container.</li><li>Using transform, filter, perspective etc.</li></ul><p>You can find <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context#the_stacking_context">the full list on MDN</a></p><p>When a new stacking context is created with new stacking levels then they are independent of all other stacking contexts and stacking levels on the page.<br>All the children inside a stacking context are locked inside and they can’t compete with elements out of their context no matter how large their z-index value is.</p><p>For example here despite box2 having such a large z-index value it can’t compete with box1. The only one who can compete with box1 is secondBoxWrapper just because it has created a new stacking context. <br>Try making another box(say box3) inside secondBoxWrapper and give some z-index to it with position relative. Now, box2 can compete with this box3.</p><h4><strong>How can we fix the above example?</strong></h4><p>We want box2 with z-index: 999999 to beat box1 with z-index:2.</p><p>This can be done by removing the z-index property from the secondBoxWrapper class. This way secondBoxWrapper can’t create a new stacking context. Now, box1 and box2 will be in the same stacking context and when they compete, box2 will be the clear winner.</p><p>We can think of some other ways too but I am leaving this up to you. Try your thoughts in the examples above.</p><h4>Important points to keep in mind</h4><ol><li>z-index won’t work without position property. Try setting z-index in the first pen without position property.<br>However, flex children can use z-index even if they’re statically-positioned.</li><li>z-index values are auto/integer/inherit which are self-explanatory.</li><li>z-index: auto does not create a stacking context. This is important because a parent with ‘auto’ will appear in front of a child with -1, but a parent with 0 will appear behind a child with -1.</li></ol><h4><strong>Conclusion</strong></h4><p>After all this, you might want to say this to z-index.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*wTJcZDYkp9K6qeiqJGnhew.png" /></figure><p>But, if there were no stacking contexts we would have to give different z-index values every time we wanted to tweak the natural order. For big projects that would be a really tiresome task.<br>For most of the problems, making sure that you don’t have parent elements limiting the z-index level of their children can do the trick.</p><p>If you enjoyed this story, please click the 👏 button and share to help others find it! Feel free to leave a comment below.</p><p>Groww Engineering publishes technical pieces, the latest knick-knacks in the coding world, and convenient ways to tackle common programming problems.</p><p>Read more of our articles <a href="https://tech.groww.in/">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83dd58d991b4" width="1" height="1" alt=""><hr><p><a href="https://tech.groww.in/understanding-the-css-z-index-property-83dd58d991b4">Understanding the CSS z-index property.</a> was originally published in <a href="https://tech.groww.in/">The Groww Engineering Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I found the “Idea” for building a good side project?]]></title>
            <link>https://medium.com/code-to-express/how-i-found-the-idea-for-building-a-good-side-project-588b759083ad?source=rss-88c8d2541946------2</link>
            <guid isPermaLink="false">https://medium.com/p/588b759083ad</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[side-project]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[project-based-learning]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Sarthak Srivastav]]></dc:creator>
            <pubDate>Thu, 06 Jun 2019 12:23:35 GMT</pubDate>
            <atom:updated>2019-06-09T05:48:41.794Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KJY2OCXdIKiM3HW1" /><figcaption>Photo by <a href="https://unsplash.com/@glenncarstenspeters?utm_source=medium&amp;utm_medium=referral">Glenn Carstens-Peters</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If you are into development and stuff then you must have known about the importance of side projects in one’s resume and also in one’s life as it makes you a better developer or engineer too. But, the problem is realising this only gives us some initial verve and we soon stumble upon the question, “What can I build as a side project?”.</p><p>The quest for the answer to this question often burns up that initial verve by following other questions like “Should the project idea be unique?”, “Should I follow some tutorial or do it by myself?”, “What technologies should I chose?” etc.</p><p>So, facing those same questions, I did many cliche side projects like weather app, Bookmark app, todo list app but they all were done following a tutorial. I must say, these helped me in building my grip over the concepts but the real learning happens only when we try to develop something from scratch i.e. without any tutorial’s or person’s help. <br>Now, for building a good project from scratch, a good idea is what you need.</p><blockquote>Now, where can we find this idea.</blockquote><p>To find that idea you just have to be a little mindful towards the problem you or any of your close ones are facing. Like, in my case I targeted one of my own problems and tried to solve it with whatever knowledge I had.</p><h3>The Problem</h3><p>When I started with Angular, the main problem which I faced was that I kept forgetting how I solved any bug I faced before. Due to that, in future, if I faced the same bug again I had to go for finding the solution again. To avoid this I got an idea to keep proper documentation of the <em>bugs I face, how I solved them, and some link related to it.</em> I searched for some good websites or apps and found Evernote to be very handy. Soon, I implemented this thing in other things too like, for the bugs, I found while doing backend development, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-4Sek0AQSDk13XPlII5ohg.png" /><figcaption>Screenshot of how I used to document the</figcaption></figure><p>But, soon I realized that 1–2 things were fine, but as more things were added, things were becoming less readable, more congested and difficult to handle. At that moment, I thought of building a more robust app where I can keep things more connected and more easily visible. I began the search and found this concept of the <a href="https://en.wikipedia.org/wiki/Leitner_system">Leitner System and spaced repetition</a>.</p><h3>The Solution</h3><p>I decided to build the app in the MEAN stack though, at that time I was good at front end only so this project made me learn a lot in backend development too. <br>I decided to keep three schemas namely <strong>genreSchema, topicSchema, and subTopicSchema </strong>which will be interrelated to each other.<br>On every page(genre, topic, and subtopic) you will be given an option to add a new genre/topic/subtopic. e.g. the genre page is like:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5mtbaULjoI0Edo-R4bo4nw.png" /><figcaption>The title filled will be added as a card on the page</figcaption></figure><p>Like, suppose I have made a genre named <em>“competitive programming”.</em>Then after clicking on it, I will be on the “<em>topics</em>” page inside the <em>“genre: competitive programming”.</em></p><p>Now, on the “<em>topics” </em>part to add new topics, click on the ‘+’ button on the extreme right to open a modal containing some form fields. First, you have to add the topic’s name then you will have two options to a question “Will there be any subtopic? ” :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*KvwYITbEvYb9Nl2Qu3pB9A.png" /></figure><p>(i) If you select no then a few more input fields will be provided to you namely:<br>(a) <strong>link:</strong> Any sort of valid link<br>(b) <strong>linkCaption:</strong> A caption for that link<br>The link and link caption will be presented in pairs and you can add as many of the links as you want.<br>© <strong>image: </strong>Any sort of valid image link, however, there is no uploading feature yet.<br>(d) <strong>imageCaption: </strong>A caption for that image<br>The image and imageCaption will be presented in pairs too and you can add as many of the images as you want.<br>(e) <strong>Description:</strong> The Description of that topic.<br>If you select this then after clicking the card, you will see a modal with the data you had given earlier. e.g. Two pointers method, it’s linked with website name in linkcaption(say geeksforgeeks article), and then a bit of description about the topic.</p><p>(ii) The second option is that you can opt for further subtopics by selecting yes to the question. If you select this then after clicking the card, you will be routed to a new page named “Subtopics inside `the topic_name you had given earlier`”. e.g. If you are in the <em>“Important questions”</em> topic then you can give questions as the sub-topics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5OT4UVgR5kE5h5O-q1mhCA.png" /><figcaption>When “No” is selected we will be given further options to fill</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rSYsD5lSoeC1TAS9oSuyAA.png" /><figcaption>If selected “Yes”, then there won’t be any options</figcaption></figure><p>Similarly on the “<em>subTopics” </em>section,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZkD-ITTj_yMjAI2lTK9hMw.png" /></figure><p>Now, for revision or just having a look at something you just have to go in the genre, the concerned topic or to the concerned sub-topic.<br>So there are two possible flows :<br>(i) Genre -&gt; Topic -&gt; end.<br>(ii) Genre -&gt; Topic -&gt; Sub-Topic -&gt; end.</p><p>After reaching a terminal point(i.e. with no further routing), the cards will open up to a modal as shown below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JZPwmQM1w9KQpEzmhmD71g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SNZxFaYw5VBpWf-NcXLUZA.png" /></figure><p>Some other features:-<br>1. If a genre or topic is empty i.e. there is no topic in a genre or no subtopic in the topic then we can delete the genre or topic by hitting the “X” button on the top right of the card.<br>2. The site has been authenticated with jsonwebtokens so your data will be authorized to you only.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sc4EfsqSFhfsW1cNIgdnfg.png" /><figcaption>The login page</figcaption></figure><p>3. The 3 dots on the top-right will open up to a small menu containing:-<br> (i) The name of the user logged in.<br> (ii) Log Out<br>(iii) An option of help to give a scenario about the site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*zGDosYiD0YsxojGL1N4Lfw.png" /></figure><p>4. The name “Blazey” is just on a whim, it doesn’t have any meaning.</p><p>So, buckle up your minds and go for that one lousy problem and use your skills to eradicate it and in the process build an awesome side project.</p><p>In case you like the project a little then you can contribute to the project, as there are many things to do like I have coded the UI of the search field but it is not working yet.</p><p>I have hosted my project on Heroku here: <a href="https://blazey.herokuapp.com/">https://blazey.herokuapp.com/</a><br>The GitHub repo is here: <a href="https://github.com/SarthakSri98/Blazey">https://github.com/SarthakSri98/Blazey</a></p><h3>Get your own blog published on C2E Blog</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ONkkzu1AYRCweHBuAMmDig.png" /></figure><p>Do you want to write for CodeToExpress? We would love to have you as a technical writer. Send us an email with a link to your draft at <a href="/service/mailto:codetoexpress@gmail.com">codetoexpress@gmail.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=588b759083ad" width="1" height="1" alt=""><hr><p><a href="https://medium.com/code-to-express/how-i-found-the-idea-for-building-a-good-side-project-588b759083ad">How I found the “Idea” for building a good side project?</a> was originally published in <a href="https://medium.com/code-to-express">Code To Express</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Brief Intro to electronJS for getting started]]></title>
            <link>https://medium.com/developers-stacks/a-brief-intro-to-electronjs-for-getting-started-2e925560278?source=rss-88c8d2541946------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e925560278</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[desktop-app]]></category>
            <category><![CDATA[electronjs]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Sarthak Srivastav]]></dc:creator>
            <pubDate>Mon, 18 Feb 2019 14:56:17 GMT</pubDate>
            <atom:updated>2019-05-25T12:36:47.673Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Brief Intro to Electron.js for getting started</h3><p>So, this is not a long time before when I first came to know about electron.js. Before that time I was only into web development and had no idea about building android apps, desktop apps, etc. So, for a person like me, the tagline of electron.js was enough to enthrall me towards it.</p><blockquote>Build cross platform desktop apps with JavaScript, HTML, and CSS</blockquote><h3><strong>Getting Started</strong></h3><p>So, I will be giving a brief introduction to what electron basically is and what are some basic things to know about it to get started.<br>Electron is essentially a node development. To turn our operating system into an environment capable of building desktop apps with electron we merely need:<br>* Node.js<br>* OS command line client understanding and<br>* npm</p><ol><li>npm init</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fu3ea_OObjj4AmhhxfqPZg.jpeg" /><figcaption>This is how you fill the package.json file in node and electron with npm init</figcaption></figure><p>2. npm install — save- dev electron</p><p>3. <strong>Electron development<br> </strong>The electron module exposes features in namespaces.<br>The lifecycle of the app: electron.app<br>The window can be created through electron.browserWindow<br>They both can be used in a file as:<br><em>const { app, browser window } = require(‘electron’);</em></p><p>4. <strong>npm start </strong>will run the app</p><p>5. <strong>Electron app architecture<br></strong>So, every electron process runs with two processes, the main process, and the renderer process, that’s it. <br><strong>Main process</strong>: In electron, the process that runs package.json’s main script is called the main process. There will only be one main process.<br><strong>Renderer process: </strong>Since electron uses chromium for displaying web pages so chromium’s multi-process architecture is also used, hence each web page in electron runs in its own process called the renderer process.</p><p>6. <strong>Electron API’s<br></strong>There are a number of API’s given in electron. Some can be used only in of the processes mentioned above and some can be used in both.<br>* remote module is used to use an API from main to the renderer and provides a simple way to do IPC(inter-process communication) between them.<br>* You can use Nodejs APIs like fs module, os module, etc. in both of the processes.</p><p>So, this is all about a brief introduction to electron</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e925560278" width="1" height="1" alt=""><hr><p><a href="https://medium.com/developers-stacks/a-brief-intro-to-electronjs-for-getting-started-2e925560278">A Brief Intro to electronJS for getting started</a> was originally published in <a href="https://medium.com/developers-stacks">Developers Stacks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[KWOC | Kharagpur Winter of Code Final Report]]></title>
            <link>https://medium.com/developers-stacks/kwoc-kharagpur-winter-of-code-final-report-f9defabc63d4?source=rss-88c8d2541946------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9defabc63d4</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[desktop-app]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Sarthak Srivastav]]></dc:creator>
            <pubDate>Mon, 14 Jan 2019 16:10:48 GMT</pubDate>
            <atom:updated>2019-05-25T12:38:14.498Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ck5Dnsje-rO8xZkU" /><figcaption>Photo by <a href="https://unsplash.com/@ikukevk?utm_source=medium&amp;utm_medium=referral">Kevin Ku</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>About KWOC</h4><p>KWOC or Kharagpur Winter of Code is a 5-week long online program for the students of various colleges across the country who are new to open source software development.</p><p>I had heard about open source contributions before but every time I tried to get my hands dirty, I got intimidated. Sometimes it was hard to find the right project and sometimes the code written by some other was too hard to comprehend. That’s when I came to know about KWOC by one of my senior who had himself participated in it a year before and had a very sound experience. I was not much confident but I thought to give it a shot anyways and that shot proved to be very fruitful.</p><h4>Choosing the project</h4><p>The first thing was to choose a project to contribute to the next 5 weeks. I was well versed with javascript and began searching for the projects in it. I found <a href="https://github.com/nityanandagohain/SoundHaven">soundHaven</a> under <a href="https://www.linkedin.com/in/nityananda-gohain/">Nityananda Gohain </a>who was very helpful throughout the tenure.</p><blockquote>SoundHaven is a native cross-platform music player.<br>Built using Angular 5 and Electron. Single code base but can be built for a different platform (Mac Os, Linux, windows etc).</blockquote><h4>Getting Started</h4><p>First of all, I joined the gitter channel and contacted my mentor and expressed my willingness to work on the project which he readily accepted. I had worked on various projects in Angular before and was well versed with version control but had no idea about Electron.<br>I began searching online and found a few tutorials and first got a bit confident in working with the electron. Time was slipping fast so I started analyzing the project for issues or bugs.</p><h4>MY CONTRIBUTIONS</h4><ol><li><strong>PR#43 For solving issue #42 <br></strong>The issue was <a href="https://github.com/nityanandagohain/SoundHaven/issues/42">When there is no song in the sidebar, still, it shows a heart. #42</a>. I solved it with a simple use of *ngIf.</li><li><strong>PR#46 For solving the issues #41 and #45<br></strong>Issue#41: <a href="https://github.com/nityanandagohain/SoundHaven/issues/41">Play the song on its own after selecting it from the file or folder</a><br>Issue#45: <a href="https://github.com/nityanandagohain/SoundHaven/issues/45">Play songs by selecting them from the sidebar.</a></li><li><strong>PR#48 A pull request to solve the major and minor design issues<br></strong>There were many design issues and the app was a bit less user-friendly so I made the necessary changes which were accepted by Nitya with this.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*iY0ZhZnH0p2C0kXllZIGog.png" /></figure><p>4. <strong>PR#51 Delete option integrated on the sidebar</strong></p><p>5.<strong> PR#53 Updated the #README<br></strong>As said,<strong> “</strong><em>A great README file helps your project to stand out from the sea of open-source software on GitHub.”<br></em>I never gave much attention to the readme of my projects but the truth is writing a good readme is as important as the project. I wrote a scenario of the whole project for a particular user and included required screenshots for user simplicity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*uGGyhIn8x3ZMtqiy7IkL6g.png" /></figure><h4>CONCLUSION</h4><p>So, all in all, it was a great experience participating in KWOC, contributing to “Sound-Haven” and working under Nitya who helped me every time whether it was merging a PR, searching a new issue, KWOC related problem or resources for learning. <br>I got introduced to various aspects of programming and most of all I got familiar at reading and working with other people’s codes.It gives me immense delight and zeal to do more after seeing my name on the leaderboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*85sBD621ZXcLYx53yzgVFA.png" /></figure><p>So, I am very grateful to <a href="https://kossiitkgp.in/">Kharagpur open source society</a> as they organized such an awesome event for letting developers like us to get familiar with the open source realm.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9defabc63d4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/developers-stacks/kwoc-kharagpur-winter-of-code-final-report-f9defabc63d4">KWOC | Kharagpur Winter of Code Final Report</a> was originally published in <a href="https://medium.com/developers-stacks">Developers Stacks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular 2+: How I Developed my First Side Project from Scratch and gained Confidence.]]></title>
            <link>https://medium.com/developers-stacks/angular-2-how-i-developed-my-first-side-project-from-scratch-and-gained-confidence-a10be5a6409d?source=rss-88c8d2541946------2</link>
            <guid isPermaLink="false">https://medium.com/p/a10be5a6409d</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[projects]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Sarthak Srivastav]]></dc:creator>
            <pubDate>Sat, 12 Jan 2019 18:16:33 GMT</pubDate>
            <atom:updated>2019-05-25T12:38:34.404Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PUwR-RuWj1xzZNX5" /><figcaption>Photo by <a href="https://unsplash.com/@rawpixel?utm_source=medium&amp;utm_medium=referral">rawpixel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>So this was the time of April 2018, when I began learning Angular. I started with the cliche official docs tutorial ‘tour of heroes’ and got familiar with the basics of angular. However, it was more like a tutorial that gives you the code of everything and you just copy it.</p><p>Though, not gaining much confidence after that I continued the official docs and learned many things. The initial ones were not so difficult like interpolation, event binding, directives but as I proceeded the learning curve got steeper and steeper. Observables, HTTP module, dependency injection all just started to blow my mind. So, I realized that only reading or learning from the docs isn’t going to help much so I rushed to google for searching project ideas. I got a few tutorials on youtube including the<a href="https://www.youtube.com/watch?v=DIVfDZZeGxM"> BookMarker</a> app, however, Brad sir built it without any frameworks but I tried to build it with angular, so it was a bit of learning. But still, there were tons of features of Angular which weren’t cared of while building it(no observables, no http, no dependency injection nothing).</p><p>So, the next thing was to realize that I had to develop a project completely on my own i.e. without any reference to any tutorial and trust me building a project completely from a scratch is on a whole different level than building a project according to some tutorial.</p><p>I began searching for ideas and came up with an idea of building a site which will show videos on search. I decided to use<a href="https://developer.dailymotion.com/api"> Dailymotion’s API</a> for the task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oTJWPp8BXR4aR-8r" /><figcaption>This is the final landing page of my project.</figcaption></figure><p>So, I am not going to give any sort of tutorial on building this project as the central idea of this blog post is to build projects on your own from scratch. This will include just an overview of the project so that you can give it a shot on your own.</p><ol><li>The first feature to include was to make the search bar functional, for which I used:</li></ol><pre><a href="https://api.dailymotion.com/videos?fields=id,thumbnail_url%2Ctitle&amp;search=%22+str+%22&amp;limit=%22+this.limit"><em>“https://api.dailymotion.com/videos?fields=id,thumbnail_url%2Ctitle&amp;search=&quot;+str+&quot;&amp;limit=&quot;+this.limit</em></a></pre><p>The str variable was equal to the value I got by the search bar. I used<a href="https://malcoded.com/posts/angular-fundamentals-reactive-forms"> reactive forms</a> for smooth data transferring.</p><p>The result is this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KghHlB0Kir6Hkkqq" /></figure><p>The good looking ‘+’ icon and the stream video online button was all with the help of<a href="https://material.angular.io/components/categories"> Angular Material</a>.</p><p>2. Now it was easy to just give the URL of the video from the Dailymotion and redirect every time to Dailymotion when we hit the stream button. But, I decided to stream the video on my own site.</p><p>Now, when we click on the button a smooth looking<a href="https://material.angular.io/components/dialog/overview"> modal</a> will open up containing the video embed and few of its details.</p><p>The landing page code was like this:</p><pre>&lt;div *ngFor=’let video of videoArray;let i = index’&gt;<br>&lt;a [href]=’video.thumbnail_url’&gt;</pre><pre>&lt;img [src]=”video.thumbnail_url”&gt;&lt;/a&gt;</pre><pre>And the modal code:&lt;div class=”videoInfo”&gt;</pre><pre>&lt;button mat-mini-fab title=”Add to favourites” (click)=’addToFav(i)’&gt;&lt;i class=”fa fa-plus”&gt;&lt;/i&gt;&lt;/button&gt;</pre><pre>&lt;p&gt;{{video.title}}&lt;/p&gt;</pre><pre>&lt;button mat-raised-button (click)=”open(embedVideo,i)”&gt;Stream video Online&lt;/button&gt;</pre><pre>&lt;/div&gt;</pre><pre>&lt;/div&gt;</pre><p>I gave a template reference variable in the <em>&lt;ng-template&gt; </em>as embedVideo</p><p>then used it in the open() function as an argument.</p><p>The modal code:</p><pre>&lt;ng-template #embedVideo let-c=”close” let-d=”dismiss”&gt;</pre><pre>&lt;div class=”modal-header”&gt;</pre><pre>&lt;p style=”color:black;text-align: center” mat-dialog-title&gt;{{ currentVideoName }}&lt;/p&gt;</pre><pre>&lt;button type=”button” class=”close” aria-label=”Close” (click)=”Cross_click()”&gt;</pre><pre>&lt;span aria-hidden=”true”&gt;&amp;times;&lt;/span&gt;</pre><pre>&lt;/button&gt;</pre><pre>&lt;/div&gt;</pre><pre>&lt;div class=”modal-body”&gt;</pre><pre>&lt;div class=”video-container”&gt;</pre><pre>&lt;iframe frameborder=”0&quot; [src]=”embedUrl | safe” allowfullscreen allow=”autoplay”&gt;&lt;/iframe&gt;</pre><pre>&lt;/div&gt;</pre><pre>&lt;/div&gt;</pre><pre>&lt;/ng-template&gt;</pre><p>The embed video API I used was :</p><p><a href="https://api.dailymotion.com/embed/videos?fields=id,thumbnail_url%2Ctitle&amp;search=%22+str"><em>“https://api.dailymotion.com/embed/videos?fields=id,thumbnail_url%2Ctitle&amp;search=&quot;+str</em></a></p><p>After all this the button was working :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*G4l2mjSdWWo2IkIb" /><figcaption>The modal shows the embed video</figcaption></figure><p>At this time my project was about to complete. But I gave myself one more challenge i.e. to include a favorites tab in the navigation bar.</p><p>The challenge for me was that I didn’t have any knowledge of backend at that time so I search about it and got to know about local storage. However, even after that, there were a whole lot of difficulties I overcame to include this functionality. While doing the project I was constantly struggling with the new bugs and errors I found and googling helped me every time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*k0PhlrM30QoKx0bK" /><figcaption>The favorites section</figcaption></figure><h3>CONCLUSION</h3><p>After doing this project, I felt much more confidence inside me as an Angular developer. It made me through with many things about angular like:-</p><ol><li>The most important feature of angular is Routing. I used it in the navigation bar.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*dYYvbnO_c9Ge6YmY" /></figure><p>2. For calling the DailyMotion APIs I had to use the httpClient module.</p><p>3. For various design features like raised-buttons, input and the modal itself I used angular-material.</p><p>4. The search results come in an animated piling up manner which I implemented with the help of<a href="https://angular.io/guide/animations"> Angular Animations</a>.</p><p>5. I made two services one for favorites and other for the videos. That made me learn about using data between the components and the dependency injection.</p><p>6. LocalStorage for saving favorite videos.</p><p>At last, I hope this was of some help to you guys. Like this, you can create a movie search app, weather forecast app etc.</p><p>You can contribute to this <a href="https://github.com/SarthakSri98/ngVideoz">project</a> too as there are many functionalities which can be added here like there is no backend support right now.</p><p>The site is hosted on firebase<a href="https://ngmuzic-d1010.firebaseapp.com/home"> here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a10be5a6409d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/developers-stacks/angular-2-how-i-developed-my-first-side-project-from-scratch-and-gained-confidence-a10be5a6409d">Angular 2+: How I Developed my First Side Project from Scratch and gained Confidence.</a> was originally published in <a href="https://medium.com/developers-stacks">Developers Stacks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>