<?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 Zeljko Radic on Medium]]></title>
        <description><![CDATA[Stories by Zeljko Radic on Medium]]></description>
        <link>https://medium.com/@zeljkoradic?source=rss-ddd72212952f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qk7duAJz5HQo8NBBV_DxEg.png</url>
            <title>Stories by Zeljko Radic on Medium</title>
            <link>https://medium.com/@zeljkoradic?source=rss-ddd72212952f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 22:17:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zeljkoradic/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Angular 7 is Here]]></title>
            <link>https://medium.com/@zeljkoradic/angular-7-is-here-be4d138304c8?source=rss-ddd72212952f------2</link>
            <guid isPermaLink="false">https://medium.com/p/be4d138304c8</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Zeljko Radic]]></dc:creator>
            <pubDate>Wed, 24 Oct 2018 15:24:38 GMT</pubDate>
            <atom:updated>2018-10-24T15:24:38.693Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZV0KoOwoH10ZuT-m" /><figcaption>“photo of white painted building under blue and white sky” by <a href="https://unsplash.com/@jeremyforlife?utm_source=medium&amp;utm_medium=referral">Jeremy Galliani</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Angular team blessed us with another major version of Angular. October 2018 was the month when developers expected the next version to hit the net and they delivered. But most of you are wondering what are the new features that come with the new version.</p><p>It is conveniently easy to transition from V6 to V7. In a matter of minutes actually. Simply run the following command via your terminal:</p><p><em>ng update @angular/cli @angular/core</em></p><p>Voila, you’re running Angular 7 now providing that the update went smoothly.</p><h3>What are the new features?</h3><p><strong>Application Performance</strong></p><p>Developers can now use performance budgeting, which is enabled by default in V7 allowing them to increase or reduce memory budget by updating <em>angular.json</em> file.</p><blockquote>Budgets is a feature in the Angular CLI which allows you to set budget thresholds in your configuration to ensure parts of your application stay within boundaries which you set.</blockquote><p><strong>Angular Material</strong></p><p>There aren’t many changes in Angular Material as of version 7, but if you’re an Angular Material user, you’ll spot some minor visual improvements which are aligned with the updated spec of Material Design. You can also choose between <em>select</em> and <em>mat-select</em> now.</p><p><strong>Virtual Scrolling and Drag &amp; Drop</strong></p><p><strong>Virtual scrolling </strong>offers smooth and faster user experience for scrolling through a large set of list items, displaying constant list of items until user scrolls for more. This functionality can now be used out-of-the-box thanks to Angular 7.</p><p><strong>Drag &amp; drop</strong> is in the CDK now as well, which includes automatic rendering as well as transferring items between lists.</p><p><strong>Angular Elements</strong></p><blockquote><em>Angular Elements now supports content projection using web standards for custom elements. — </em>Stephen Fluin</blockquote><p><strong>What’s the latest on Ivy?</strong></p><p>Ivy, the rendering engine introduced a couple of months ago, is still not officially used by Angular. The team will announce an opt-in preview in the coming months.</p><p>However, if you would still like to enable and play with it, read <a href="https://medium.com/lacolaco-blog/quick-start-for-enabling-angular-v6-ivy-compiler-161ef492e243">this tutorial</a>.</p><p>All in all, future is bright for Angular. I can’t wait to see what the Angular team has in store for the next major release.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be4d138304c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use of TypeScript in Node.js Projects]]></title>
            <link>https://medium.com/@zeljkoradic/use-of-typescript-in-node-js-projects-5c33e36da748?source=rss-ddd72212952f------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c33e36da748</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Zeljko Radic]]></dc:creator>
            <pubDate>Sun, 14 Oct 2018 15:43:12 GMT</pubDate>
            <atom:updated>2018-10-14T20:12:21.229Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BDDZ17ta-BZecXEg" /><figcaption>“Code on a computer” by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>You’re a Node.js developer and a thought of using TypeScript instead of JavaScript in your Node.js projects crossed your mind. You’ve heard wonderful things about TypeScript and now you want to be a part of that bandwagon too! Rightfully so.</p><h4><strong>What is TypeScript?</strong></h4><p>Per Wikipedia:</p><blockquote>TypeScript is an open-source programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript, and adds optional static typing to the language.</blockquote><p>Use of TypeScript has many benefits. I’ll list some:</p><ul><li>Optional static typing (the key here is optional);</li><li>Type Inference, which gives some of the benefits of types, without actually using them;</li><li>Access to JavaScript’s ES6 and ES7 features, before they become supported by major browsers;</li><li>The ability to compile down to a version of JavaScript that runs on all browsers.</li></ul><h4>Bundle Node.js Project</h4><p>So how do we start? I will assume that you are familiar with how to setup basic Node.js project. Install Node.js and Express framework on your local machine, as well as npm modules and then create a folder where you would like to save your project. Easy stuff.</p><p>Next step would be to create a file simply called <em>app.ts</em>. Feel free to copy/paste the following code:</p><pre>import * as express from &#39;express&#39;;</pre><pre>class App {</pre><pre>   public express</pre><pre>   constructor () {<br>       this.express = express();<br>       this.mountRoutes();<br>   }</pre><pre>   private mountRoutes (): void {<br>      const router = express.Router();</pre><pre>      router.get(&#39;/&#39;, (req, res) =&gt; {<br>        res.json({<br>          message: &#39;Node.js Starter!&#39;<br>        })<br>      });</pre><pre>      this.express.use(&#39;/&#39;, router);<br>   }<br>};</pre><pre>export default new App().express;</pre><p>Now we need to setup <em>index.ts</em> file as well, which will serve as the main root file for the project. The code that needs to go there is the following:</p><pre>import app from &#39;./app&#39;;</pre><pre>const port = process.env.PORT || 3000;</pre><pre>app.listen(port, (err) =&gt; {<br>   if (err) {<br>      return console.log(err)<br>   }</pre><pre>   return console.log(`server is listening on ${port}`);<br>});</pre><p>Now we have a skeleton Node.js project written in TypeScript. But that’s not all. TypeScript needs to be compiled into plain JavaScript code because browsers can’t read TypeScript code.</p><p>Open your terminal, go to your project’s root directory and type in the following command:</p><pre>tsc</pre><p>However, please note that you will also need to setup some configuration files before <em>tsc</em> can be run successfully. Review <em>tsconfig.json</em> file inside the TypeScript starter code, which is posted below.</p><p><a href="https://github.com/zeljkorad/node-typescript">zeljkorad/node-typescript</a></p><p>I hope this post gave you an insight on how to jumpstart your Node.js projects using TypeScript. If you have any observations and/or questions, feel free to post them in the comments section below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c33e36da748" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Custom Form Validators in Angular 6 Using Regular Expressions]]></title>
            <link>https://medium.com/@zeljkoradic/custom-form-validators-in-angular-6-using-regular-expressions-d421a5655adf?source=rss-ddd72212952f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d421a5655adf</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[regular-expressions]]></category>
            <category><![CDATA[validation]]></category>
            <dc:creator><![CDATA[Zeljko Radic]]></dc:creator>
            <pubDate>Sun, 19 Aug 2018 16:56:20 GMT</pubDate>
            <atom:updated>2018-10-24T15:33:51.501Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Utg8ATbu30m_hqOk" /><figcaption>“Black and white shot of urban building windows with shadow, Grande Arche de la Defense” by <a href="https://unsplash.com/@bixphotos?utm_source=medium&amp;utm_medium=referral">Benjamin Bousquet</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>While Angular does provide various input field validators (i.e. email), there are use cases where you will need to create your own validators. That’s when the power of regular expressions shines brightly.</p><h4><strong>What are Regular Expressions?</strong></h4><p>So what are regular expressions (abbr. regexp)?</p><blockquote>Regular expressions are patterns used to match character combinations in strings.</blockquote><p>Regular expressions can be defined in two simple ways:</p><pre>let re = /ab+c/;</pre><p>Or calling the constructor function of the RegExp object:</p><pre>let re = new RegExp(‘ab+c’);</pre><p>However, I won’t go into too many details in regards to regular expressions because the sole focus of this article is Angular. There are many online resources on how to use regular expressions properly, so here is <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions">one</a> which comes in handy.</p><h4>Reactive Form Validation</h4><p>Considering that Angular has two distinct approaches when it comes to implementation of the forms, our focus will be on reactive forms, the other one being <a href="https://angular.io/guide/forms">template driven approach</a>.</p><p>Now let’s get back to the basics on how to initiate a reactive form. First, you will need to import the following line into your app’s module file:</p><pre>import { FormsModule, ReactiveFormsModule } from &#39;@angular/forms&#39;;</pre><p>Also, don’t forget to add it here as well:</p><pre>imports: [<br>   FormsModule,<br>   ReactiveFormsModule<br>]</pre><p>Now your Angular components are ready to accept reactive forms approach.</p><p>Secondly, generate a component of your own naming and add the following imports:</p><pre>import { FormBuilder, Validators, FormGroup } from &#39;@angular/forms&#39;;<br>import { CustomValidator } from &#39;./shared/validation&#39;;</pre><p>The first import itself is pretty self-explanatory. However, the second import CustomValidator is a custom TypeScript file, which consists of our custom validation.</p><p>Thirdly, declare a form name in your component like so:</p><pre>formName: FormGroup;</pre><p>Call FormBuilder in your component’s constructor as well:</p><pre>constructor(private fb: FormBuilder) { }</pre><p>Now the form is ready to be initiated. The following example will throw an alert if the input numberInput is empty and it will accept numbers only, meaning that you will also get an alert if you type characters that are not numbers.</p><pre>ngOnInit() {<br>   this.formName = this.fb.group({<br>      numberInput: [&#39;&#39;, [Validators.required, CustomValidator.numberValidator]]<br>   });<br>}</pre><p>Last but not least, let’s add an html part of the component:</p><pre>&lt;form (ngSubmit)=&quot;submit(formName)&quot; [formGroup]=&quot;formName&quot;&gt;<br>   &lt;div class=&quot;form-group&quot;&gt;<br>      &lt;div class=&quot;row&quot;&gt;<br>         &lt;div class=&quot;col-md-12&quot;&gt;<br>            &lt;input formControlName=&quot;numberInput&quot; type=&quot;text&quot;&gt;<br>         &lt;/div&gt;<br>      &lt;/div&gt;<br>   &lt;/div&gt;</pre><pre>   &lt;small class=&quot;form-text text-muted&quot; *ngIf=&quot;formName.get(&#39;numberInput&#39;).touched &amp;&amp; formName.get(&#39;numberInput&#39;).hasError(&#39;required&#39;)&quot;&gt;This field is required!&lt;/small&gt;</pre><pre>   &lt;small class=&quot;form-text text-muted&quot; *ngIf=&quot;formName.get(&#39;numberInput&#39;).touched &amp;&amp; formName.get(&#39;numberInput&#39;).hasError(&#39;invalidNumber&#39;)&quot;&gt;Numbers accepted only!&lt;/small&gt;</pre><pre>   &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot; [disabled]=&quot;formName.invalid&quot;&gt;Submit&lt;/button&gt;<br>&lt;/form&gt;</pre><p>Our form is now ready to accept Angular’s built-in validation as well as a validation of our own making. The first alert throws a built-in Angular validation, while the second one is in charge of our custom validation.</p><h4><strong>Custom Validation Examples</strong></h4><p>As mentioned in the previous paragraph, here is a custom file which consists of our custom validation examples such as URL, phone number, US zip code, password, US social security number, etc.</p><p>I prefer to name this file <em>validation</em>, but you can name it whatever you deem fit.</p><pre>export class CustomValidator {</pre><pre>// Validates URL<br>static urlValidator(url): any {<br>   if (url.pristine) {<br>      return null;<br>   }</pre><pre>   const URL_REGEXP = /^(http?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&amp;%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?&#39;\\+&amp;%$#=~_-]+))*$/;</pre><pre>   url.markAsTouched();</pre><pre>   if (URL_REGEXP.test(url.value)) {<br>      return null;<br>   }</pre><pre>   return {<br>      invalidUrl: true<br>   };<br>}</pre><pre>// Validates passwords<br>static matchPassword(group): any {<br>   const password = group.controls.password;<br>   const confirm = group.controls.confirm;</pre><pre>   if (password.pristine || confirm.pristine) {<br>      return null;<br>   }</pre><pre>   group.markAsTouched();</pre><pre>   if (password.value === confirm.value) {<br>      return null;<br>   }</pre><pre>   return {<br>      invalidPassword: true<br>   };<br>}</pre><pre>// Validates numbers<br>static numberValidator(number): any {<br>   if (number.pristine) {<br>      return null;<br>   }</pre><pre>   const NUMBER_REGEXP = /^-?[\d.]+(?:e-?\d+)?$/;</pre><pre>   number.markAsTouched();</pre><pre>   if (NUMBER_REGEXP.test(number.value)) {<br>      return null;<br>   }</pre><pre>   return {<br>      invalidNumber: true<br>   };<br>}</pre><pre>// Validates US SSN<br>static ssnValidator(ssn): any {<br>   if (ssn.pristine) {<br>      return null;<br>   }</pre><pre>   const SSN_REGEXP = /^(?!219-09-9999|078-05-1120)(?!666|000|9\d{2})\d{3}-(?!00)\d{2}-(?!0{4})\d{4}$/;</pre><pre>   ssn.markAsTouched();</pre><pre>   if (SSN_REGEXP.test(ssn.value)) {<br>      return null;<br>   }</pre><pre>   return {<br>      invalidSsn: true<br>   };<br>}</pre><pre>// Validates US phone numbers<br>static phoneValidator(number): any {<br>   if (number.pristine) {<br>      return null;<br>   }</pre><pre>   const PHONE_REGEXP = /^(\([0-9]{3}\) |[0-9]{3}-)[0-9]{3}-[0-9]{4}$/;</pre><pre>   number.markAsTouched();</pre><pre>   if (PHONE_REGEXP.test(number.value)) {<br>      return null;<br>   }</pre><pre>   return {<br>      invalidNumber: true<br>   };<br>}</pre><pre>// Validates zip codes<br>static zipCodeValidator(zip): any {<br>   if (zip.pristine) {<br>      return null;<br>   }</pre><pre>   const ZIP_REGEXP = /^[0-9]{5}(?:-[0-9]{4})?$/;</pre><pre>   zip.markAsTouched();</pre><pre>   if (ZIP_REGEXP.test(zip.value)) {<br>      return null;<br>   }</pre><pre>   return {<br>      invalidZip: true<br>   };<br>}</pre><pre>}</pre><h4><strong>Conclusion</strong></h4><p>So that was the power of regular expressions utilized the Angular way. Please note that the code published in this article uses JavaScript ES6 as well as TypeScript. It also assumes that you are an intermediate to advanced Angular developer.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d421a5655adf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Quick Guide on How to Become a Web Developer in 2018]]></title>
            <link>https://medium.com/@zeljkoradic/a-quick-guide-on-how-to-become-a-web-developer-in-2018-94a55f69738b?source=rss-ddd72212952f------2</link>
            <guid isPermaLink="false">https://medium.com/p/94a55f69738b</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Zeljko Radic]]></dc:creator>
            <pubDate>Sun, 29 Jul 2018 19:31:43 GMT</pubDate>
            <atom:updated>2018-07-29T22:53:38.039Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TafI1CBmkIw49Rf3" /><figcaption>“Close-up of lines of code on a computer screen” by <a href="https://unsplash.com/@ilyapavlov?utm_source=medium&amp;utm_medium=referral">Ilya Pavlov</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Have you ever wondered how to end your regular 9 to 5 job and start off fresh by becoming a web developer, who is able to work remotely. Well, I have had similar thoughts back in 2009 when I no longer wanted to be a regular Joe who feels stuck at his “regular” work desk. Fast forward to 2018 and here I am working as a web developer remotely.</p><p>To say that the road has been easy would be an understatement. Sure, I spent long hours learning how to code but I have also found a job which helped me to learn the trade of the business along the way. In the end, it was worth it.</p><p>If you are willing to commit some of your precious time to coding, I am sure you will be able to get off the ground and become a full fledged web developer as well.</p><p>However, do not forget that your sole purpose should not be money. If this kind of work ignites your passion, go for it. You would not regret it. I know I have not. Otherwise, focus your energy on something that truly fulfills you.</p><p>Now, let’s start with the first important step on your way to becoming an awesome web developer.</p><h4><strong>Starting Point</strong> — Computer Science Fundamentals, HTML/CSS &amp; JavaScript/TypeScript</h4><p>Starting point is the most important. It gives you a solid and concrete base to build upon. Once you get a grasp of this initial step, you can expand your newfound knowledge and skills further.</p><p>You can skip computer science basics if you would like to, but I would personally recommend against it. Computer science is a great starting point because it teaches you how computers work, to put it in plain words.</p><p>The second important step is to start getting familiar with HTML and CSS. While HTML is not a programming language itself, it is a major component of the web. Every single web app out there was built in HTML and CSS to say the least. So what are HTML and CSS?</p><blockquote><strong>HTML</strong> is a hypertext markup language used for creating website layouts.</blockquote><blockquote>Cascading Style Sheets (abbr. <strong>CSS</strong>) is a style sheet language used for describing the presentation of a document written in a markup language like HTML.</blockquote><p>In other words, HTML is used to create a structure of the website whilst CSS is used to style the structure, which was defined in HTML. HTML and CSS go hand in hand. One is meaningless without the other.</p><p><strong>Codeacademy</strong> has great courses on HTML and CSS, so make sure to check those out in the link below:</p><p><a href="https://www.codecademy.com/catalog/language/html-css">https://www.codecademy.com/catalog/language/html-css</a></p><p><strong>JavaScript</strong> is, on the other hand, a programming language. Gone are the days when JavaScript was used to create dynamic elements on your web page solely. Today, JavaScript is used to power some major technologies such as Node.js, Angular, React, vue.js, to name a few. The best thing about JavaScript is that is used to power both back-end and front-end development, which is a big advantage if you would like to dive deep into back-end and front-end development simultaneously.</p><p>If you want to learn more about JavaScript, head over to <a href="https://developer.mozilla.org/bm/docs/Web/JavaScript">Mozilla</a> and check out their complete and well rounded reference guide.</p><p>On a related note, use of JavaScript can be supplemented with TypeScript, which will be a great addition to your skills set. According to TypeScript’s official website,</p><blockquote>TypeScript is typed superset of JavaScript that compiles to plain JavaScript.</blockquote><p>It is an open-source programming language developed and maintained by Microsoft. TypeScript gained a lot of attention when Google’s Angular development team decided to use it for the next major release of Angular.</p><p>To learn more about TypeScript, go to this <a href="http://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html">useful link</a>.</p><h4><strong>Front-end Frameworks — </strong>Bootstrap</h4><p>Once you are ready to continue learning web development skills, the next step would be to dive into an HTML/CSS framework such as Twitter’s Bootstrap. Bootstrap has been around since 2009 and I believe it is here to stay for the foreseeable future. The framework will make your life much easier when you want to create prototypes for your next web project quickly. It comes with predefined elements, which can be modified to suit your needs. Sure, you can code in vanilla HTML and CSS, but Bootstrap has a powerful grid system for laying out web pages, which will save some of your precious time. Also, keep an eye on CSS grid which can also be used to create grid based layouts without Bootstrap.</p><p>Head over to Bootstrap’s <a href="https://getbootstrap.com/docs/4.1/getting-started/introduction/">official website</a> to learn more about the framework.</p><h4>Front-end Frameworks — <strong>Angular</strong></h4><p>Now let us dive into the world of single page applications. Single page applications (abbr. SPA) are a culprit of today’s front-end development. In order to become a full fledged front-end developer, HTML/CSS and Bootstrap will not suffice. Your knowledge will need to be complemented by one more front-end framework at least. My personal favorite is <strong>Angular</strong>, but there are many options that are gaining momentum as well such as <strong>vue.js</strong>. Once you get a full grasp of HTML/CSS and vanilla JavaScript, jump with your arms wide open into the world of SPAs.</p><p>Developed and maintained by Google, AngularJS was the first front-end framework of its kind when it was unleashed to the public back in 2009. Written in JavaScript, AngularJS changed the way we build front-end applications. It introduced us with the concept of lighting fast web apps (in the vein of mobile apps speed and user experience). AngularJS is still used today, but to a lesser degree. Disregard learning AngularJS in favor of a major rewrite of the framework simply called <strong>Angular</strong>.</p><p>Released in 2016, Angular (also known as Angular 2+) was completely rewritten in TypeScript by the same AngularJS team.</p><p>If you want to study Angular, Udemy has some great courses on the subject. My personal recommendation is <a href="https://www.udemy.com/user/maximilian-schwarzmuller/"><strong>Maximilian Schwarzmüller</strong></a><strong>’s </strong>course on Angular, which costs $10 only. It’s a bargain deal and must read for every aspiring Angular developer.</p><p>Please note that Angular is not the only front-end framework/library used by front-end developers nowadays. <strong>React</strong> and <strong>vue.js </strong>are major players as well, and you might make a decision to stay away from Angular and focus on one of those two after you watch this video, which will give you a detailed info on each popular front-end framework. See it for yourself and decide what will float your boat.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FKMX1mFEmM3E%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DKMX1mFEmM3E&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FKMX1mFEmM3E%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e2ccb06b93f302120c8d347cdb52b94/href">https://medium.com/media/5e2ccb06b93f302120c8d347cdb52b94/href</a></iframe><h4><strong>Back-end World &amp; Databases</strong>— PHP, node.js, Python, mongoDB &amp; MySQL</h4><p>It is however, important to note that your skills can be improved by learning back-end development as well. You can find a job by becoming a front-end developer and maybe that kind of development is something that sparks your fire. It’s your call, ultimately. But for the sake of this quick guide, we sure need to mention some of the great technologies and achievements on the back-end side too.</p><p>When it comes to back-end development, there are so many options to choose from but I will list programming languages that are the best fit in 2018. On the plus side, JavaScript can be used on the back-end side as well if you decide to take the route of learning <strong>Node.js</strong> as your primary back-end “tool&quot;. However, do not forget that most websites are powered by PHP. On top of that, the world’s most popular content management system WordPress was built in PHP. But Node.js and PHP are not the only options when it comes to back-end. Python is great as well, which is used for machine learning, so keep that in mind.</p><p>Each of those programming languages are supplemented by many great back-end frameworks. Node.js works great with express, PHP with Laravel and Python with Django.</p><p><em>References for learning more about Node.js, express, PHP, Laravel, Python and Django:</em></p><p><a href="https://developer.mozilla.org/en-US/docs/Learn/Server-side/Node_server_without_framework">Node.js</a>/<a href="https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs">Express</a></p><p><a href="https://www.w3schools.com/pHP/default.asp">PHP</a>/<a href="https://www.tutorialspoint.com/laravel/">Laravel</a></p><p><a href="https://www.codecademy.com/catalog/language/python">Python</a>/<a href="https://docs.djangoproject.com/en/2.0/">Django</a></p><p>Let’s not forget about databases. There are two types of databases used widely today: relational and non-relational databases. You may have heard of MySQL and MongoDB. Two of the most popular databases used for eCommerce websites, enterprise systems, etc.</p><p>MySQL belongs to the world of relational databases, which are great for almost any kind of web application. However, the same can be said for MongoDB.</p><blockquote><strong>MySQL</strong> is an open-source relational database management system (RDBMS). Its name is a combination of “My”, the name of co-founder Michael Widenius’s daughter, and “SQL”, the abbreviation for Structured Query Language.</blockquote><blockquote><strong>MongoDB</strong> is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas.</blockquote><p>Now comes the tough part. Depending on your project, how do you choose between the two databases? Considering that the question falls out of scope of this article, I will reference another article to aid you in making that decision.</p><p><a href="https://hackernoon.com/mongodb-vs-mysql-comparison-which-database-is-better-e714b699c38b">MongoDB vs. MySQL</a></p><h4>Learn Git</h4><p>Git is a version control system, which helps you maintain your code and publish it online. It is also a great tool for collaborative work.</p><blockquote>It is primarily used for source code management in web development, but it can be used to track changes in any set of files.</blockquote><p>When it comes to online tools for git version control, GitHub and GitLab are the first that came to my mind. Those are two major players that I have used in the past and still do.</p><p>GitHub is incredibly popular in the developer community, and only continues to flourish. There are three main reasons why every aspiring developer should start learning GitHub: everyone uses it, source control and to get active in the community.</p><p>This <a href="https://www.youtube.com/playlist?list=PLyuRouwmQCjlxyO-45o53YCWjBCM-fA7L">YouTube playlist</a> has everything that will get you covered when it comes to GitHub.</p><h4><strong>Blogs</strong></h4><p>In order to keep your skills sharp and up to date, reading industry related blogs is crucial. Web technologies are evolving on a daily basis and you sure want to stay on the cutting edge, otherwise you are at risk of having your knowledge become obsolete.</p><p>My personal favorite is <a href="https://thenextweb.com/">The Next Web</a>. The Next Web was started to bring insight, meaning — and every now and again, the lulz — to the world of technology. Then there is <a href="https://www.webdesignerdepot.com/">Web Designer Depot</a>, which is a great resource for front-end developers as well as <a href="https://www.smashingmagazine.com/">Smashing Magazine</a> with great resources on JavaScript, responsive web design, HTML, WordPress, etc.</p><p>And let us not forget about <strong>Medium</strong>. I have read it many a time only to find great tips and tricks on many emerging and well established technologies.</p><p>I know that many of those references to web programming might intimidate newbies. But be sure to digest this content in small bits otherwise you will end up overwhelmed. Please note that it takes time to sharpen skills, as in any endeavor in business and life. You cannot become a superb force in the world of web over night and you should not strive to. Commit yourself to small goals and keep track of your progress. In the end, you will feel thankful and victorious for accomplishing goals that you have always wanted to accomplish.</p><p>Read it, share it, clap it and add your thoughts in the comments section below. Again, thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94a55f69738b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Loader Bar on Every HTTP Request in Angular 6]]></title>
            <link>https://medium.com/@zeljkoradic/loader-bar-on-every-http-request-in-angular-6-60d8572a21a9?source=rss-ddd72212952f------2</link>
            <guid isPermaLink="false">https://medium.com/p/60d8572a21a9</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[angular-6]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Zeljko Radic]]></dc:creator>
            <pubDate>Sun, 10 Jun 2018 20:50:20 GMT</pubDate>
            <atom:updated>2018-07-09T21:03:27.673Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Hc9x7otcX6OaDwNj" /><figcaption>Photo by <a href="https://unsplash.com/@chrissie?utm_source=medium&amp;utm_medium=referral">chrissie kremer</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As many Angular developers are aware, the front-end framework does not offer a loader bar whenever we want to initiate a new HTTP request. For that purpose alone, we need to either install some sort of package or develop a custom service. Before I get going on how to implement a custom loader bar, here is a <a href="https://github.com/zeljkorad/angular-loader"><strong>Github link</strong></a><strong> </strong>with the code<strong> </strong>that you may use in your projects.</p><p>Let’s start. I will assume that you have a basic to intermediate knowledge on how to use Angular CLI, which can generate components and services for your Angular project.</p><h4>Loader Component</h4><p>First of, let’s create a new component called <em>Loader.</em> Add the following piece of code inside loader’s component html file when you finish generating a component:</p><pre>&lt;div [class.hidden]=&quot;!show&quot;&gt;<br>  &lt;div class=&quot;loader-overlay&quot;&gt;<br>    &lt;div *ngIf=&quot;show&quot; class=&quot;loader&quot;&gt;&lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/div&gt;</pre><p>The code itself is pretty self-explanatory. After you’re done, copy/paste this code into loader’s component ts file:</p><pre>import { Component, OnInit, OnDestroy } from &#39;@angular/core&#39;;<br>import { Subscription } from &#39;rxjs&#39;;</pre><pre>import { LoaderService } from &#39;../_services/loader.service&#39;;<br>import { LoaderState } from &#39;./loader&#39;;</pre><pre>@Component({<br>  selector: &#39;app-loader&#39;,<br>  templateUrl: &#39;./loader.component.html&#39;,<br>  styleUrls: [&#39;./loader.component.css&#39;]<br>})<br>export class LoaderComponent implements OnInit, OnDestroy {</pre><pre>  show = false;</pre><pre>  private subscription: Subscription;</pre><pre>  constructor(private loaderService: LoaderService) { }</pre><pre>  ngOnInit() {<br>    this.subscription = this.loaderService.loaderState<br>    .subscribe((state: LoaderState) =&gt; {<br>      this.show = state.show;<br>    });<br>  }</pre><pre>  ngOnDestroy() {<br>    this.subscription.unsubscribe();<br>  }</pre><pre>}</pre><p>The component was built using the latest version of RxJS imports. You will also notice that the component imported <em>loader service</em> as well as <em>loader </em>ts file.</p><p>The last bit of code before we finalize loader’s component would be loader’s styling. Copy/paste the following CSS code into loader’s component CSS file or Angular’s common styles.css file. Your call.</p><pre>.hidden {<br>  visibility: hidden;<br>}</pre><pre>.loader-overlay {<br>  position: absolute;<br>  width: 100%;<br>  z-index: 500000;<br>  top: 0;<br>}</pre><pre>.loader {<br>  height: 4px;<br>  width: 100%;<br>  position: relative;<br>  overflow: hidden;<br>  background-color: #FFF;<br>}</pre><pre>.loader:before {<br>  display: block;<br>  position: absolute;<br>  content: &quot;&quot;;<br>  left: -200px;<br>  width: 200px;<br>  height: 4px;<br>  background-color: red;<br>  animation: loading 2s linear infinite;<br>}</pre><pre>@keyframes loading {<br>  from {left: -200px; width: 30%;}<br>  50% {width: 30%;}<br>  70% {width: 70%;}<br>  80% {left: 50%;}<br>  95% {left: 120%;}<br>  to {left: 100%;}<br>}</pre><p>Now we have a component that is ready to be used. Let’s move on to loader’s services.</p><h4>Loader Service</h4><p>We will generate a new service simply called <em>loader</em>. Inside loader.service.ts file add the following code:</p><pre>import { Injectable } from &#39;@angular/core&#39;;<br>import { Subject } from &#39;rxjs&#39;;</pre><pre>import { LoaderState } from &#39;../loader/loader&#39;;</pre><pre>@Injectable({<br>  providedIn: &#39;root&#39;<br>})<br>export class LoaderService {</pre><pre>  private loaderSubject = new Subject&lt;LoaderState&gt;();<br>  loaderState = this.loaderSubject.asObservable();</pre><pre>  constructor() { }</pre><pre>  show() {<br>    this.loaderSubject.next(&lt;LoaderState&gt;{ show: true });<br>  }</pre><pre>  hide() {<br>    this.loaderSubject.next(&lt;LoaderState&gt;{ show: false });<br>  }</pre><pre>}</pre><p>As you may have noticed, there is no need to have this service provided via NgModule as of Angular 6. Other than that, there is one more import that is relevant to loader’s state, which is either true or false. So let’s generate one more file which will be named <em>loader.ts</em>.</p><pre>export interface LoaderState {<br>  show: boolean;<br>}</pre><h4>Loader Interceptor Service</h4><p>The last important piece of the puzzle is Loader Interceptor service. We will create a service, which will utilize Angular’s HTTP Interceptor. HTTP Interceptor is used when we need to intercept HTTP requests.</p><pre>import { Injectable, Injector } from &#39;@angular/core&#39;;<br>import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest, HttpResponse } from &#39;@angular/common/http&#39;;<br>import { Observable, pipe } from &#39;rxjs&#39;;<br>import { tap } from &#39;rxjs/operators&#39;;</pre><pre>import { LoaderService } from &#39;../_services/loader.service&#39;;</pre><pre>@Injectable({<br>  providedIn: &#39;root&#39;<br>})<br>export class LoaderInterceptorService implements HttpInterceptor {</pre><pre>  constructor(private loaderService: LoaderService) { }</pre><pre>  intercept(req: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {</pre><pre>    this.showLoader();</pre><pre>    return next.handle(req).pipe(tap((event: HttpEvent&lt;any&gt;) =&gt; { <br>      if (event instanceof HttpResponse) {<br>        this.onEnd();<br>      }<br>    },<br>      (err: any) =&gt; {<br>        this.onEnd();<br>    }));<br>  }</pre><pre>  private onEnd(): void {<br>    this.hideLoader();<br>  }</pre><pre>  private showLoader(): void {<br>    this.loaderService.show();<br>  }</pre><pre>  private hideLoader(): void {<br>    this.loaderService.hide();<br>  }</pre><pre>}</pre><p>Also, don’t forget to import and provide HTTP Interceptor and Loader Service in <em>app.module.ts </em>or your app’s core module.</p><pre>import { HTTP_INTERCEPTORS } from &#39;@angular/common/http&#39;;<br>import { LoaderInterceptorService } from &#39;./_services/loader-interceptor.service&#39;;</pre><pre>...</pre><pre>providers: [<br>  {<br>    provide: HTTP_INTERCEPTORS,<br>    useClass: LoaderInterceptorService,<br>    multi: true<br>  }<br>]</pre><h4>Wrapping It All Up</h4><p>Loader bar gives a nice touch to every Angular app and it’s a nifty UI/UX addition. Feel free to use and distribute this code in your projects. I know I will.</p><p>In case you want to see <strong>loader</strong> in action, here is the<strong> </strong><a href="https://zeljkorad.github.io/angular-loader/"><strong>link</strong></a>.</p><p>P.S. This article consists of a rewrite of the code published <a href="https://medium.com/beautiful-angular/show-loader-on-every-request-in-angular-2-9a0fca86afef">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60d8572a21a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Best Practices for Writing Angular 6 Apps]]></title>
            <link>https://medium.com/@zeljkoradic/best-practices-for-writing-angular-6-apps-e6d3c0f6c7c1?source=rss-ddd72212952f------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6d3c0f6c7c1</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[angular-cli]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Zeljko Radic]]></dc:creator>
            <pubDate>Sun, 03 Jun 2018 21:48:08 GMT</pubDate>
            <atom:updated>2019-05-06T20:00:48.953Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lceN42yJAt66swlD" /><figcaption>“A desaturated shot of a tall skyscraper” by <a href="https://unsplash.com/@charliehu?utm_source=medium&amp;utm_medium=referral">Changyu Hu</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Considering that I have been using Angular for the past year or so, I find it one of the best front-end frameworks out on the web today. Google’s Angular team did their best to rewrite the framework and today we have a great tool for developing awesome single page applications. This article’s focus will be the latest version of Angular, which was released recently. I will assume that you have a basic to intermediate knowledge of Angular at least before you delve deep into this article.</p><p>Without further ado, let’s list some of the best practices for writing clean and usable Angular apps.</p><h4><strong>1. Use of Angular CLI</strong></h4><p>Angular comes equipped with a command line interface called Angular CLI, which helps you scaffold your code in minutes.</p><p>Angular CLI can be installed easily via terminal by typing in the following command:</p><pre>npm install -g @angular/cli</pre><p>Both the CLI and generated project have dependencies that require Node 8.9 or higher, together with NPM 5.5.1 or higher, so make sure to install those.</p><p>To generate and start a new project locally, use:</p><pre>ng new PROJECT-NAME<br>cd PROJECT-NAME<br>ng serve -o</pre><p>The tool can also be used for generation of modules, services, components, directives and pipes. I won’t detail those commands here. However, feel free to visit <a href="https://cli.angular.io/">Angular CLI’s official website</a> for more info.</p><h4>2. Develop Angular apps in modular fashion using core, shared and feature modules</h4><p>When you start developing in Angular, you may be tempted to disregard creation of modules for the sake of using components solely. That approach might be fine for smaller apps, but as your app starts to grow, development will become cumbersome. That’s when separation of concerns steps in, which is fueled by a modular Angular app.</p><p>Splitting your app into <em>core</em>, <em>shared</em> and <em>multiple feature modules</em> will make your life much easier. Each module can have its own components, services, directives and pipes.</p><p><strong>Core module</strong> should be created of components (i.e. header, main navigation, footer) that will be used across the entire app.</p><p><strong>Shared module</strong> can have components, directives and pipes that will be shared across multiple modules and components, but not the entire app necessarily.</p><p>Last but not least are<strong> feature modules</strong>. Per Angular’s official documentation, feature module is:</p><blockquote>an organizational best practice, as opposed to a concept of the core Angular API. A feature module delivers a cohesive set of functionality focused on a specific application need such as a user workflow, routing, or forms. While you can do everything within the root module, feature modules help you partition the app into focused areas. A feature module collaborates with the root module and with other modules through the services it provides and the components, directives, and pipes that it shares.</blockquote><h4>3. Lazy loading a feature module</h4><p>Lazy loading a feature module is the best approach when it comes to accessing a module via Angular’s routing. That way we will be able to make our Angular app faster. In other words, a feature module won’t be loaded initially, but when you decide to initiate it. Therefore, making an initial load of the Angular app faster too! It’s a nifty feature.</p><p>Here is an example on how to initiate a lazy loaded feature module via <em>app-routing.module.ts</em> file.</p><pre>const routes: Routes = [<br>  {<br>    path: &#39;dashboard&#39;,<br>    loadChildren: &#39;app/dashboard/dashboard.module#DashboardModule&#39;,<br>    component: CoreComponent<br>  }<br>];</pre><h4>4. Use of smart vs. dummy components</h4><p>Most common use case of developing Angular’s components is a separation of smart and dummy components. Think of a dummy component as a component used for presentation purposes only, meaning that the component doesn’t know where the data came from. For that purpose, we can use one or more smart components that will inherit dummy’s component presentation logic.</p><p>Here is a <a href="https://blog.angular-university.io/angular-2-smart-components-vs-presentation-components-whats-the-difference-when-to-use-each-and-why/">useful read</a> that will give you more insight on the subject, because the complexity of the matter requires a new post/article.</p><h4>5. Proper use of dependency injection in Angular 6</h4><p>Come Angular 6, there have been some changes for the better when it comes to providing services in Angular. The old way would be to state services explicitly inside <em>providers</em> inside of NgModule. Not anymore. If you have been using the latest version of Angular and Angular CLI, you will notice that the CLI generates the following piece of code whenever you generate a new service:</p><pre>@Injectable({<br>  providedIn: &#39;root&#39;<br>})</pre><p>It is the new way of providing services in Angular. Also, please note that <em>root </em>can be replaced with any module where you wish to provide your service with. Your old code will still work, but consider replacing it with the new one as soon as possible.</p><h4>6. Aliases for imports</h4><p>Creating aliases for imports is a plus. We may use imports three folders deep sometimes, so the following import is not the ideal solution:</p><pre>import { LoaderService } from &#39;../../../loader/loader.service&#39;;</pre><p>Add the following piece of code into <em>tsconfig.json</em> file to make your imports short and well organized across the app:</p><pre>{<br>  &quot;compileOnSave&quot;: false,<br>  &quot;compilerOptions&quot;: {<br>    removed for brevity,</pre><pre>    &quot;paths&quot;: {<br>      &quot;@app/*&quot;: [&quot;app/*&quot;],<br>      &quot;@env/*&quot;: [&quot;environments/*&quot;]<br>    }<br>  }<br>}</pre><p>When you’re done, these imports</p><pre>import { LoaderService } from &#39;../../../loader/loader.service&#39;;<br>import { environment } from &#39;../../environment’;</pre><p>should be refactored into these:</p><pre>import { LoaderService } from &#39;@app/loader/loader.service&#39;;<br>import { environment } from &#39;@env/environment’;</pre><p>Short and sweet!</p><h4><strong>That’s it.</strong></h4><p>I hope that you find some of these tips useful and that they can serve as pointers at least. Also, please support this article with claps and feel free to add your thoughts in the comments section below. Thanks for reading!</p><figure><a href="https://usejournal.com/?utm_source=medium.com&amp;utm_medium=noteworthy_blog&amp;utm_campaign=tech&amp;utm_content=guest_post_image"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PYxBP_WV7LI6zc-zdUkNqQ.png" /></a></figure><p>📝 Read this story later in <a href="https://usejournal.com/?utm_source=medium.com&amp;utm_medium=noteworthy_blog&amp;utm_campaign=tech&amp;utm_content=guest_post_read_later_text">Journal</a>.</p><p>👩‍💻 Wake up every Sunday morning to the week’s most noteworthy stories in Tech waiting in your inbox. <a href="https://usejournal.com/newsletter/noteworthy-in-tech/?utm_source=medium.com&amp;utm_medium=noteworthy_blog&amp;utm_campaign=tech&amp;utm_content=guest_post_text">Read the Noteworthy in Tech newsletter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6d3c0f6c7c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>