<?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[Angular Medellin - Medium]]></title>
        <description><![CDATA[Angular Medellín - Medium]]></description>
        <link>https://medium.com/angularmedellin?source=rss----432a26e1c754---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Angular Medellin - Medium</title>
            <link>https://medium.com/angularmedellin?source=rss----432a26e1c754---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 11:51:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/angularmedellin" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Deploying your Angular app to Github Pages using Travis-CI]]></title>
            <link>https://medium.com/angularmedellin/deploying-your-angular-app-to-github-pages-using-travis-ci-baca2e1c30e7?source=rss----432a26e1c754---4</link>
            <guid isPermaLink="false">https://medium.com/p/baca2e1c30e7</guid>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[travis-ci]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[github-pages]]></category>
            <dc:creator><![CDATA[JuanJo Rendon]]></dc:creator>
            <pubDate>Thu, 07 Jun 2018 20:15:37 GMT</pubDate>
            <atom:updated>2019-01-17T21:38:16.296Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deploying your Angular app to GitHub Pages using Travis-CI</h3><h4>Automation makes our lives easier and keep us out of common problems.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*spkpCQWQSyqmf1Qcn8Gyzg.jpeg" /><figcaption>Photo on <a href="https://foter.com/">Foter.com</a></figcaption></figure><p>I’m lazy AF and I take everything that makes my life easy and smooth, Software development is not different to me. I avoid doing the following tasks manually:</p><ul><li>Building the app</li><li>Create the artifact when the build is done</li><li>Publish to the target environment</li><li>Wait for deployment</li></ul><p>I love automation, so once I push my changes I want to see them deployed automatically.</p><p>We are going to talk about it in this post, so we are going to start simple, let’s create a new Angular project with the Angular CLI (<em>I’m using Angular v6</em>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*iNk3pT0GbijQ8DGAWWMXDQ.png" /></figure><p>Create a new repository on GitHub and push it to GitHub.<br>Now we are ready to set up our pipeline to automate the deploying process of our app, let’s start adding our awesome project to Travis-CI.</p><ol><li>In the root of the project create a new file named .travis.yml</li><li>Populate this file with the gist below</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/db0a9c6a3ee9297d3217a0fb76c630df/href">https://medium.com/media/db0a9c6a3ee9297d3217a0fb76c630df/href</a></iframe><p><em>but, what does it mean? what is happening there?</em></p><p>Don’t worry, this is just the configuration of:</p><ul><li>The language and runtime we want to use (Node/JavaScript)</li><li>The branch(es) we want to build</li><li>Some folders we want in the cache to make the process faster and</li><li>The way to install-test-build our project.</li></ul><p>I’m going to focus in two steps <strong>scripts </strong>and <strong>deploy.</strong></p><h4><strong>Scripts:</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5YVL8dTCJzEF2crH_UDqCA.png" /></figure><ul><li>yarn lint will check the syntax of the code, if fails the build and deploy will be skipped.</li><li>yarn build --base-href will build our application, same as lint, if fails deploy will be skipped.</li><li>mv dist/my-awesome-project/index.html dist/my-awesome-project/404.html will create a 404.html file needed in Github pages when your app use the Angular Router.</li></ul><blockquote><strong>Spoiler Alert:</strong> if any of the scripts above fail, the whole process will fail.</blockquote><h4>Deploy:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*wfsGaqrDgihZGTuPuiOTrw.png" /></figure><blockquote><em>Deploying to GitHub Pages uses </em>git push --force<em> to overwrite the history on the target branch, so make sure you only deploy to a branch used for that specific purpose, such as </em>gh-pages<em>. It is possible to disable this “force push” behavior by setting </em>keep-history<em> option to </em>true<em>.</em></blockquote><blockquote>from <a href="https://docs.travis-ci.com/user/deployment/pages/">Travis-CI Docs</a></blockquote><ol><li>provider: Tells Travis-CI where you want to deploy your project.</li><li>skip_cleanup: true: Prevents the reset of the current working directory and the deletion of all changes made during the build.</li><li>github_token: This token in generated in your GitHub repo to perform Git operation via API. Click <a href="https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/">here</a> to create your own token. (we are going to talk about this later but please copy the token in a safety place where you can grab it later).</li><li>local_dir: The physical path where the output artifact was built. (Is important to note that path may change to dist/ if you are using Angular version &lt; 6).</li><li>on: branch:Specify what branch(es) you want to deploy. Any branch outside this config will build but not will be deployed.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*y2WwCv9AxDmS99AVEZxmxA.jpeg" /></figure><p>We’ve set everything in the code to automate our building/deploying process, now is time to tell Travis-CI how things will work. Sign up in <a href="https://travis-ci.com/">Travis-CI</a> with your GitHub account and select my-awesome-project in the list of repos, then click in the settings button.</p><p>Turn on Build only if .travis.yml is preset (if you want to build any new push for any branch set up your General config like the one below).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wkbA0iGM7GazbCGvNTQosw.png" /></figure><p>Travis-CI by default build only the last commit and cancel the older ones, unless there is a build running, it will be queued in the waiting list. I like to have an history of builds so I disable these options, doing this each new commit will be queued and will run its own build. You can configure this in the section ‘Auto Cancellation’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*baRYuCDv81RaKgFUC-U2Sw.png" /><figcaption>that’s the configuration that i chose</figcaption></figure><p>We’ve reached the most important step in all of this automated process configuration, the way Travis-CI is allowed to push to our repo, and the answer is with the github token that we talked about earlier, in the “Environment Variables” section paste your token in the field ‘Value’ and name it ‘GITHUB_TOKEN’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GeAfklDSoFRBoCMC-q2VPw.png" /></figure><p>With all this set our pipeline is completed, now it’s time to see how magic happens, so let’s do it!!</p><ul><li>In command line create a new branch git checkout -b my-awesome-branch master</li><li>In app.component.ts change title = &#39;app&#39; by title = &#39;my awesome project&#39;</li><li>Commit this change git add . git commit -m &quot;change app title”</li><li>Push it git push -u origin my-awesome-branch</li><li>Create a new Pull Request to Master and you will see how everything starts to work</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*0N9CfqbUnVjFpsSHTFiAGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8sTAV4dehuHxRbVAfNa8MA.png" /></figure><p>Our branch start building, yay!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FDpB9NBjny7jF1pd0yt2%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FDpB9NBjny7jF1pd0yt2%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExOG5pZzAwZm1hc2pubGlld2E5OW1memd2NHB6dGdjcm54eWh0NDBiZCZlcD12MV9naWZzX2dpZklkJmN0PWc%2FDpB9NBjny7jF1pd0yt2%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="246" frameborder="0" scrolling="no"><a href="https://medium.com/media/5a15cf7303d881818a46b84f581157e8/href">https://medium.com/media/5a15cf7303d881818a46b84f581157e8/href</a></iframe><p>But we are halfway to our goal, deploy it to GitHub Pages.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F4BB8y6rRCf5bW%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F4BB8y6rRCf5bW%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F4BB8y6rRCf5bW%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="264" frameborder="0" scrolling="no"><a href="https://medium.com/media/114b327a8c1ab67281377993ae5e6b50/href">https://medium.com/media/114b327a8c1ab67281377993ae5e6b50/href</a></iframe><p>You might notice the deploy was skipped, that’s because we told Travis-CI only deploy master branch, but all build process was successful.</p><p>Now is time to merge my-awesome-branch to master . The pipeline start over</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tO0AqwfGmL0tq9trDdH46w.png" /></figure><p>Master branch starts building and when is finish the application is deployed, a new branch named gh-pages is automatically created, Travis-CI takes care to obtain the built artifact and push it to this branch.</p><p>The only thing remain is use GitHub Pages to serve our site, go to your repo Settings &gt; GitHub Pages section and select gh-pages branch.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FfDzM81OYrNjJC%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FfDzM81OYrNjJC%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FfDzM81OYrNjJC%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="258" frameborder="0" scrolling="no"><a href="https://medium.com/media/b8a870bb9e03ee3a274ab36c808a6aa2/href">https://medium.com/media/b8a870bb9e03ee3a274ab36c808a6aa2/href</a></iframe><p><strong>Our site is alive!!!!!</strong> From now on we’ll only take care of making our app more and more awesome!!</p><p>**Update <a href="https://medium.com/u/bd1cd197da0d">Dharmen Shah</a> suggest to add a 404.html file to avoid the 404 error page not found when the Angular app has routing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=baca2e1c30e7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/angularmedellin/deploying-your-angular-app-to-github-pages-using-travis-ci-baca2e1c30e7">Deploying your Angular app to Github Pages using Travis-CI</a> was originally published in <a href="https://medium.com/angularmedellin">Angular Medellin</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular V6 CLI Config]]></title>
            <link>https://medium.com/angularmedellin/angular-v6-cli-config-42955e5f7889?source=rss----432a26e1c754---4</link>
            <guid isPermaLink="false">https://medium.com/p/42955e5f7889</guid>
            <category><![CDATA[angular-6]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[angular-cli]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Carlos Esteban Lopez Jaramillo]]></dc:creator>
            <pubDate>Wed, 09 May 2018 19:50:50 GMT</pubDate>
            <atom:updated>2018-05-09T19:50:50.556Z</atom:updated>
            <content:encoded><![CDATA[<p>A new version of Angular has been released, with it a new CLI that brings changes on how we set configs.</p><h4>1. The issue? 😲</h4><p>Its <a href="https://github.com/angular/angular-cli/wiki/config">documentation</a> isn’t very verbose, so you’re left with doubts about what to do. For example, in the previous version you could set <strong>yarn</strong> as the default package manager like this:</p><pre>ng set packageManager=yarn<br>// Or if you want to set it globally<br>ng set --global packageManager=yarn</pre><p>However the new way to go with CLI V6 is this one:</p><pre>ng config cli.packageManager yarn<br>// Or if you want to set it globally<br>ng config -g cli.packageManager yarn</pre><p>The difference is clear, but there’s no documentation about the paths for the variables you can configure, or even the accepted values. Essentially we’re in the dark here 😥.</p><p>Now let me show you the ways of the <strong>config </strong>command, and how to know what can be configured in Angular V6 CLI 😉.</p><h3>2. How to use it</h3><p>The <strong>config</strong> command usage can be found in the <a href="https://github.com/angular/angular-cli/wiki/config">documentation</a>, though it doesn’t shows you which properties you can configure.</p><p>In basic terms you need <strong>a path and a value</strong> for the property you want to configure. Without the value it would only print the current value. If the path is something like <strong>cli.packageManager</strong> and you want to configure it with <strong>Yarn</strong>, then this is how the command would look like:</p><pre>ng config cli.packageManager yarn</pre><p>You can make this the default configuration for all your new projects by adding <strong>-g</strong> or <strong>--global</strong> flag:</p><pre>ng config <strong>-g</strong> cli.packageManager yarn</pre><p>Now, let’s explore how we get to know which properties are configurable.</p><h3>3. Reading the Schema</h3><p>To find out what parameters are configurable in the <strong>config </strong>command<strong> </strong>we need to know where to get the schema from(basically what paths &amp; values can be used). This file is available at:</p><pre> <em>node_modules/@angular/cli/lib/config/schema.json</em></pre><p>It looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*ko7YFIfS1ukUkq2J69QpUA.png" /><figcaption><em>node_modules/@angular/cli/lib/config/schema.json</em></figcaption></figure><p>The important part here are the properties. Do you remember the path previously used to set <strong>yarn </strong>as package manager? We used <strong>cli.packageManager,</strong> right? Well, the schema for the <strong>cli </strong>properties are shown in line <strong>:13.</strong> You’ll notice it’s a <strong>reference </strong>for an object called <strong>cliOptions</strong> under <strong>definitions </strong>property. That’s our target in this case:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*LHyMUXM5dPDNpjLBka5gog.png" /></figure><p>The <strong>cli</strong> property can have multiple properties like <strong>defaultCollection, packageManager</strong> and a few others…</p><p>Do you see where we’re going with this? To set the desired package manager we have to use the <strong>cli.packageManager </strong>path because that’s what the schema accepts.</p><p>The good thing about knowing how to read the schema is that you can find the description and the type of data accepted as a value. Additionally, some of them specify the options you can choose.</p><p>The <strong>packageManager</strong> for instance can receive a string, but not any string, it has an <strong>enum</strong> property, which tells you which strings you can pass to this property. In this case the <strong>Angular CLI</strong> accepts “<strong>npm</strong>”, “<strong>yarn</strong>” &amp; “<strong>cnpm</strong>” (I didn’t even know <strong>cnpm</strong> existed).</p><h3><strong>4. What Now?</strong></h3><p>Now you know how to use the command, how to check the schema &amp; build the paths for the properties to configure.</p><p>The schema is huge (1605 lines at Angular V6 release), but if you know what config you’re searching for, just search by a keyword, with a bit of luck it will available in the property key or in the description.</p><p>Now feel 😎(awesome) for knowing how to configure your Angular project.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42955e5f7889" width="1" height="1" alt=""><hr><p><a href="https://medium.com/angularmedellin/angular-v6-cli-config-42955e5f7889">Angular V6 CLI Config</a> was originally published in <a href="https://medium.com/angularmedellin">Angular Medellin</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lazy loading Angular Modules]]></title>
            <link>https://medium.com/angularmedellin/lazy-loading-angular-modules-58fc844b5c7d?source=rss----432a26e1c754---4</link>
            <guid isPermaLink="false">https://medium.com/p/58fc844b5c7d</guid>
            <category><![CDATA[lazy-loading]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[angular-router]]></category>
            <dc:creator><![CDATA[Juan Camilo Giraldo Chaverra]]></dc:creator>
            <pubDate>Fri, 26 Jan 2018 19:32:25 GMT</pubDate>
            <atom:updated>2024-07-23T20:10:46.603Z</atom:updated>
            <content:encoded><![CDATA[<p>Angular provides an efficient, elegant and easy way to manage module loading at runtime as soon as the user requests certain features of our application. Other than being ‘<em>feature fancy</em>’, its a way to reduce our application bundle via outsourcing application features that are not required at startup time.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FMP1kygLQzjCve%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FMP1kygLQzjCve%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FMP1kygLQzjCve%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="245" frameborder="0" scrolling="no"><a href="https://medium.com/media/a944c394179ba118c05e3882296f1791/href">https://medium.com/media/a944c394179ba118c05e3882296f1791/href</a></iframe><p>Thanks to <a href="https://angular.io/api/router">@angular/router</a> package, implementing this in our applications is easier than you might think. So let’s get started.</p><h3>1. Creating our million dollar fancy application</h3><p>We’re going to use Angular CLI to create our application, let’s create a new app.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/847e690e02c9879d6f577c1659d0788c/href">https://medium.com/media/847e690e02c9879d6f577c1659d0788c/href</a></iframe><blockquote>For those who are getting started, this command will create an angular application and its basic structure, followed by the dependency installation. For more please refer to<a href="https://github.com/angular/angular-cli"> @angular/cli</a>.</blockquote><p>Notice I passed the <em>routing </em>flag to our <em>ng new </em>command, this will generate the routing for our application.</p><h3>2. Creating our main components</h3><p>Let’s suppose we’re going to have two main components in our app, the former is going to be the HomeComponent where our users will visit our application when they hit let’s say <em>fancy-app.fancydomain.</em></p><p>The latter, our BigFeatureComponent that’s gonna be the one we will <em>Lazy Load</em> as the user navigates through our application. So let’s create them using angular CLI.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f85d72db406c82b2703c6d2776cb43ba/href">https://medium.com/media/f85d72db406c82b2703c6d2776cb43ba/href</a></iframe><blockquote>For the purpose of this tutorial, we are skipping the creation of test files passing the spec=false flag. Do not forget to add tests to your production ready applications.</blockquote><p>This way angular CLI will <em>automagically</em> create our two new components and updates our <em>AppModule</em> for us with its respective declarations. More info about @angular/cli commands can be found <a href="https://github.com/angular/angular-cli">here</a></p><p>For now our project structure should look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*tAbZoyvD6bPpotd7b7rLfw.png" /></figure><h3>3. Adding features to our Application</h3><p>For now, we have all our application structure generated. Now is time to start adding those <em>game-changing</em> features.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FtoXKzaJP3WIgM%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FtoXKzaJP3WIgM%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExeTZyazE4aGtqeXdxZTVsbjQ1cXg3bmNhMXd0bWx1ZmtkcGN4eXhxbCZlcD12MV9naWZzX2dpZklkJmN0PWc%2FtoXKzaJP3WIgM%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="261" frameborder="0" scrolling="no"><a href="https://medium.com/media/655d7c648c376b31edea59577be27bf1/href">https://medium.com/media/655d7c648c376b31edea59577be27bf1/href</a></iframe><p>First we’re going to create the routing for our application, which will be in charge of mocking up the navigation of our application as the users perform application tasks. Open up our<em> app-routing.module.ts </em>and complete it up with the following routes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a67ea23dee6d17c908ac0a809cd6caa9/href">https://medium.com/media/a67ea23dee6d17c908ac0a809cd6caa9/href</a></iframe><blockquote>For a more detailed information about how the @angular/router package works, here’s the <a href="https://angular.io/guide/router">official documentation.</a></blockquote><p>By adding this, our angular app will register the path routes /<em>home</em> and /<em>bigComponent </em>and make them available to the user, as they use our app show them the appropriate content, <em>HomeComponent </em>and <em>BigFeatureComponent </em>respectively.</p><p>Each of the components will have its own <em>game changer</em> feature, but for the purpose of this blog post I’ll keep things simple and will focus in what really matters, how to Lazy load an angular Module. More on that later.</p><p>I added each of the respectively anchor tags to our <em>HomeComponent </em>and <em>BigFeatureComponent </em>HTML’s, to be able to navigate through our application components.</p><p>Our <em>home-component.component.html</em> should look like this.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0d78b02e1cf6dbcf08d85cdd82f8c907/href">https://medium.com/media/0d78b02e1cf6dbcf08d85cdd82f8c907/href</a></iframe><p>And our <em>big-feature.component.html</em> like this.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7e3da50c22452dad3318ed495f0b098a/href">https://medium.com/media/7e3da50c22452dad3318ed495f0b098a/href</a></iframe><p>And to make sure we’ve been following around our <em>app.module.ts</em> should look like this so far, with the respective component declarations and the routes registered as imports.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d08c4dd12507ac5398b63938a1c262cf/href">https://medium.com/media/d08c4dd12507ac5398b63938a1c262cf/href</a></iframe><h3>4. Running our App</h3><blockquote>ng serve</blockquote><p>Now if we fire up our application, we should see this screens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*vXMSZHx9M4rPtz1y0by_WA.gif" /><figcaption>Navigating through our app.</figcaption></figure><blockquote>Nothing fancy to see here…</blockquote><p>Right now, our application bootstraps all the needed resources at boot time. Each component defined previously, is bundled in the initial package that our apps serves to the client requesting our application.</p><p>We can see this in our browser’s devtools network tab, as soon as we start our application all the bundled resources of our application are downloaded and while the user navigates through it everything is available as the application were downloaded at the startup time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*RRmGWiaAM7tImeINg3AfVA.gif" /><figcaption>Application served at startup time, with all the assets needed to work as a single page application</figcaption></figure><h3>5. Adding module lazy loading</h3><p>So far so good. Now we want to lazy load our components as soon as the user requests certain feature of our application. First, we should create a new Module, which is necessary to wrap up the components that are going to be lazy load.</p><p>The following @angular/cli command will create our new module, called big-module.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2c358622900ed533668e2515a0d6049b/href">https://medium.com/media/2c358622900ed533668e2515a0d6049b/href</a></iframe><p>Second, we need to adjust the folder structure to reflect the wrapping of BigFeatureComponent into our new recently created Module BigModule. So far our application folder structure should look like this, with our big-module folder wrapping big-feature-component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*y9QJWosd7jNMZm-QgK-IwQ.png" /></figure><p>Now, the interesting part about this blog post. We need to register our new Module to be lazy loaded as the user request certain feature of our app. Let’s say, when the user navigates to /bigComponent route.</p><p>For this we are gonna make use of the <em>LoadChildren </em>Module<em> </em>available in the @angular/router package. Registering a route with <em>LoadChildren </em>is as easy as the following code snippet. Here we just changed, which component we’re going to load for the children module we want to lazy load.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c5645a1417fc196110774425423e4719/href">https://medium.com/media/c5645a1417fc196110774425423e4719/href</a></iframe><blockquote>The LoadChildren path should be composed by the relative path of the module without its extension + # sign + module exported class.</blockquote><p>In our case <em>‘./big-module/big-module.module#BigModuleModule’ </em>follows the latter pattern. Being <em>BigModuleModule </em>the exported class of our big-module module.</p><p>Next, we need to define the child routes of our now lazy loaded module. As we just gonna have <em>/bigComponent</em> route and not any child route after it, we just need to register the empty path as child route for our lazy loaded module followed by the component we want to load after the mentioned route is reached in our router configuration.</p><p>One interesting thing to notice here, its the use of <a href="https://angular.io/api/router/RouterModule">RouterModule</a>.forChild method. This is used because we are in a child module, being AppModule the root module of our application and is where we registered our top level application routes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/60ff9d035165f8a09a7d850de162d867/href">https://medium.com/media/60ff9d035165f8a09a7d850de162d867/href</a></iframe><blockquote><em>Only call </em><a href="https://angular.io/api/router/RouterModule"><em>RouterModule</em></a><em>.forRoot in the root </em><em>AppRoutingModule (or the </em><em>AppModule if that&#39;s where you register top level application routes). In any other module, you must call the </em><a href="https://angular.io/api/router/RouterModule"><em>RouterModule</em></a><em>.forChild method to register additional routes.</em></blockquote><p>So far so good, we’ve been through a long road. That’s all we need to get our <em>BigModule</em> lazy loaded as we navigate to <em>/bigComponent </em>route<em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*LkpJPkxWccvlW5YZ1kTidg.gif" /><figcaption>big-module.module.chunk.js downloaded as we navigate /bigComponent route path.</figcaption></figure><p>We can see in the network tab of the browser’s developer tools that our app as soon as we hit the route path, a new chunk of the application is downloaded. That’s the module being <em>Lazy Loaded.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FS3Ot3hZ5bcy8o%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FS3Ot3hZ5bcy8o%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FS3Ot3hZ5bcy8o%2Fgiphy.gif&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="339" frameborder="0" scrolling="no"><a href="https://medium.com/media/7fbc4fc542d022c0bba6afbf91b44d59/href">https://medium.com/media/7fbc4fc542d022c0bba6afbf91b44d59/href</a></iframe><p>That’s all folks, hope you have enjoyed this post and have learned how to lazy load a module in angular. Go further, and try to optimize your application using this strategy aiming to reduce the inicial bundle size and speeding application boot time.</p><blockquote>I’m looking for a new gig. Strong experience working on highly dynamic applications using both angular and reactjs. Dms open on X formerly twitter @camilogiraldo</blockquote><blockquote>Full source code can be found in github <a href="https://github.com/camilogiraldo/lazy-load-example">here</a>.</blockquote><blockquote>Be sure to follow me <a href="https://twitter.com/camilogiraldo">@CamiloGiraldo</a> and hope to share more blog post with you guys in the future. Feel free to share. Thank you.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58fc844b5c7d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/angularmedellin/lazy-loading-angular-modules-58fc844b5c7d">Lazy loading Angular Modules</a> was originally published in <a href="https://medium.com/angularmedellin">Angular Medellin</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting a Javascript library as global in Angular]]></title>
            <link>https://medium.com/angularmedellin/setting-a-javascript-library-as-global-in-angular-4bec30e50596?source=rss----432a26e1c754---4</link>
            <guid isPermaLink="false">https://medium.com/p/4bec30e50596</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Danny Gutierrez]]></dc:creator>
            <pubDate>Mon, 11 Dec 2017 13:04:39 GMT</pubDate>
            <atom:updated>2017-12-11T13:04:39.043Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*jVdLphW-fwxASqBJ2tx06A.jpeg" /><figcaption><a href="https://pixabay.com/en/globe-earth-day-earth-planet-world-2269653/">www.pixabay.com</a></figcaption></figure><p>So you found that cool magic ultra-awesome library that will solve all your problems in your Angular application, only one problem… <strong>that library needs another library didn’t wrap in an Angular module, or even worse, the library itself has no wrapper</strong> so all you have is a brand new super sport V8 car <strong>without wheels</strong></p><p>That’s what happened to me the first time I wanted to use a library called ng2-select2. It’s a cool library that helps you with your <a href="https://www.npmjs.com/package/ng2-select2">select elements</a> in an angular application. The problem came out when the documentation said that slect2 library was necessary and it ended up needing jQuery as well. Both of them, JS libraries.</p><p>Besides, ng2-select2 library needs both of them as global libraries. This let them be reached across all the application (and it’s not necessarily a bad thing as probably you’ll need your JS library to be free like a bird and be available by you anywhere in your application)</p><p>Whatever it is, I’m gonna tell you how to implement and use a global Javascript library into your angular Application and for all practical purposes<strong> </strong>I’m gonna do it with ng2-select2 and its dependencies (essentially same for any JS library)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*fz6Yo3wAfccL3TCb." /></figure><p>1- First thing you have to do is install your main library -ng2-select2 here- and save it in your package.json as it follows (omit this step if you are interested only in a JS library itself)</p><blockquote><strong>npm i -S ng2-select2</strong></blockquote><p><strong><em>**Note:</em></strong><em> you can add your JS libraries like an ordinary JS application by using a CDN and link them with a script tag into your </em><strong><em>index.html</em></strong><em> file, however it’s not a good approach as it’s not recommended by angular team (and in most cases </em><strong><em>you won’t want be touching</em></strong><em> index.html file), so try to avoid this and continue with step 2</em></p><p>2- As specified in the documentation, it needs select2 and jQuery libraries in order to work, then…</p><blockquote><strong>npm i -S jquery select2</strong></blockquote><p>Easy peasy isn’t it? Does it means is everything runs sweet? Well… NOPE</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*aqaJUX7JVQ30bB3g." /></figure><p>The next you need to do is make your JS libraries global for your application, so they are reachable everywhere in the app.</p><p>4. Import your JS libraries in the “scripts” array into your <strong><em>.angular-cli.json</em></strong> file as it follows</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c6e19e6d4cb1502b2834d6f3ee95f0f7/href">https://medium.com/media/c6e19e6d4cb1502b2834d6f3ee95f0f7/href</a></iframe><p><strong><em>**Note: </em></strong><em>Don’t forget to </em><strong><em>re-run</em></strong><em> your app due this file is not watched by the demon angular projects comes with</em></p><p>And that’s it! If you need to install any other JS library into your app, just follow the same steps and put it in the array script as shown above</p><h3>WAIT! YOU SAID WE CAN USE THOSE JS LIBRARIES ANYWHERE IN MY APP!</h3><p>Yes I did, and in order to do that I deeply suggest you to install the typings for any JS library you want to use (if there is any). It lets you type your library objects making your life easier (after all this is <strong>Type</strong>script!, that’s the greatness of it)</p><p>5. Install the typings files you need (Optional)</p><blockquote><strong>npm i -S -D @types/jquery @types/select2</strong></blockquote><p><strong>DON’T</strong> import the library you need to use into your component with the import statement (eg. <strong>import * as $ from ‘jquery’;</strong>) by doing so you’ll end up with two instances of the library (no cool!).</p><p>6. Just use it as it was already import into your component (please don’t kill me for using jQuery with Angular!)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3af3b12d9c86b1b3701c3e2e20423df0/href">https://medium.com/media/3af3b12d9c86b1b3701c3e2e20423df0/href</a></iframe><p>And that’s it!. Easy isn’t it? If you find a better approach or find an error on my approach let me know. See you next time ;)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4bec30e50596" width="1" height="1" alt=""><hr><p><a href="https://medium.com/angularmedellin/setting-a-javascript-library-as-global-in-angular-4bec30e50596">Setting a Javascript library as global in Angular</a> was originally published in <a href="https://medium.com/angularmedellin">Angular Medellin</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why I am starting to love Angular]]></title>
            <link>https://medium.com/angularmedellin/are-you-a-newbie-on-angular-772926610596?source=rss----432a26e1c754---4</link>
            <guid isPermaLink="false">https://medium.com/p/772926610596</guid>
            <category><![CDATA[community]]></category>
            <category><![CDATA[newbie]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[beginner]]></category>
            <dc:creator><![CDATA[Robin H. Abadia]]></dc:creator>
            <pubDate>Wed, 22 Nov 2017 15:35:49 GMT</pubDate>
            <atom:updated>2017-11-22T16:16:26.828Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*bsoe8hwvkiKiVIXxIRYaIw.jpeg" /></figure><p>Yes, I am one of those developers who marries one technology, platform or framework and doesn’t care too much about the other ones. I realized this is a bad practice and if you are in the technology world this couldn’t be very healthy. <strong>Why?</strong> Because nothing is forever, one technology can be very popular today but that doesn’t mean it will keep being like that the next year or even the next month.</p><p>So, I decided to start paying attention to the <em>Angular</em> framework, and I have been playing around with Angular for a couple of weeks now. Like doing little things from a big project that the company I work for is building: Checking <em>Angular</em> code on <em>GitHub</em>, watching tutorials on <em>YouTube</em>, reading the official documentation or creating small web applications in order to start grabbing the concepts.</p><p>One of the reasons why I started doing this is because of the happy and vivid community around Angular. When I first found it, I knew that I wanted to be part of it as well as to be proficient with this framework.</p><p>If you are reading this and you are a newbie as me on Angular, I would like to cheer you up to follow my steps and to start this never-ending trip, I assure you that you will be glad about the things that you can build with this technology.</p><h3>But how this change started?</h3><p>I went to an Angular Meetup, being honest, I was doubting mainly because a little voice inside of my head was saying: <em>“Man, you are doing it ok with React and React Native… so, why do you bother going to an Angular event?”</em></p><h3>Community:</h3><p>Despite of this little voice, I entered to the meetup and Bum! I felt a very positive energy there, seriously, everyone there seemed so friendly and happy. It seemed to me that I wasn’t in a common technology meetup, I was around of people who believe in Angular, who love building things with this technology and other technologies around it and also love the present and future that this technology promises to them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NJhLxkybhWn8mf0sgHWx-A.jpeg" /></figure><h3>Job Opportunities:</h3><p>When this event was finished, I went home and I made a research about Angular and the companies who are seeking Angular developers, then I realized that there is a big amount of companies seeking for persons who know Angular. This made me say something like: <em>“Oh man!… and why I don’t know Angular yet?”</em>.</p><h3>Yes, It could be hard:</h3><p>I knew that it wouldn’t be easy to start looking at different concepts or points of view when you are deep in love with one technology, like I was with <em>React</em>; but of course going through this process makes you a better developer.</p><p>So, I have been learning interesting and different concepts on Angular like two way data binding or the popular strictly typed programming language of JavaScript: <a href="https://medium.com/angularmedellin/a-brief-introduction-to-typescript-part-1-ceedb3e9b1c0"><em>TypeScript</em></a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=772926610596" width="1" height="1" alt=""><hr><p><a href="https://medium.com/angularmedellin/are-you-a-newbie-on-angular-772926610596">Why I am starting to love Angular</a> was originally published in <a href="https://medium.com/angularmedellin">Angular Medellin</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 Introduction to TypeScript — Part 4]]></title>
            <link>https://medium.com/angularmedellin/a-brief-introduction-to-typescript-part-4-961b841386bd?source=rss----432a26e1c754---4</link>
            <guid isPermaLink="false">https://medium.com/p/961b841386bd</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[introduction]]></category>
            <category><![CDATA[interfaces]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Pablo Velásquez]]></dc:creator>
            <pubDate>Sat, 28 Oct 2017 17:04:25 GMT</pubDate>
            <atom:updated>2017-10-28T19:42:43.084Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the most important principles in TypeScript is type-checking 🔍, and this focuses on the shape. So far, we have used a limited amount of data types, all of them being <strong>primitive</strong> data types. But in many scenarios we might need to implement our own custom types 🔧, and TypeScript makes this possible with the use of <strong>interfaces</strong>.</p><p>An interface in object-oriented languages is a an abstract type that defines behaviours as <strong>method signatures</strong>. It can be considered as a <strong>code contract 📝</strong>, <strong>in order to implement it we must follow its rules</strong>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FxUOrwlI2plti5cJfgI%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fkingdomaudience-season-3-kingdom-xUOrwlI2plti5cJfgI&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FxUOrwlI2plti5cJfgI%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/231cd6a3eb8d9337c83de0ebd4d7d03d/href">https://medium.com/media/231cd6a3eb8d9337c83de0ebd4d7d03d/href</a></iframe><p>Let’s create an interface called LabelledValue, this would be a custom type that assigns a label to a value:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/77f3b91a79a026215b64dfb56d579707/href">https://medium.com/media/77f3b91a79a026215b64dfb56d579707/href</a></iframe><p>Now we can use LabelledValue as a type, for instance, in a variable declaration:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dac710ee1d7ece2b085b9fc7f4071426/href">https://medium.com/media/dac710ee1d7ece2b085b9fc7f4071426/href</a></iframe><p>We need to provide all the required elements in the interface in order to use it 📝:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d98965f1a1e4bc7c416ac2d252c8e47/href">https://medium.com/media/7d98965f1a1e4bc7c416ac2d252c8e47/href</a></iframe><p>The transpiler would alert us of this error with a message like: Type “{label: string}” is not assignable to type “LabelledValue”. Property “value&quot; is missing in type “{label: string}”.</p><h3>Optional properties</h3><p>Some properties of an interface might not be required, and TypeScript allow us to define when a property is optional or not. Each optional property is denoted by a ? at the end of the property name.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1eea056e94404f805173d57795bf9cbb/href">https://medium.com/media/1eea056e94404f805173d57795bf9cbb/href</a></iframe><p>In this interface the property hexColor is optional, and we can use this interface as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c032857f1b3604d5ce48c685421890db/href">https://medium.com/media/c032857f1b3604d5ce48c685421890db/href</a></iframe><p>The advantage of optional properties is that we can describe the optional properties while still also preventing use of properties that are not part of the interface.</p><h3>Readonly properties</h3><p>Properties with the keyword readonly can only be modified when an object is first created.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7e707be19655fda359c16e9429d76919/href">https://medium.com/media/7e707be19655fda359c16e9429d76919/href</a></iframe><p>After the assignment, the values x and y can’t be changed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8da71a264ceba0aed6e5a647579d533f/href">https://medium.com/media/8da71a264ceba0aed6e5a647579d533f/href</a></iframe><p>The transpiler will alert us with the message: Left-hand side of assignment expression cannot be a constant or a read-only property.</p><p>This is pretty handy if we need an “immutable” behaviour. In general, we use const when we are using a variable , and readonly if we are using a property.</p><p>Interfaces are a very powerful feature, they allow us to have much more control over the way we structure our data. Let’s use Color interface inside Point interface, that way we can have consistency in our objects:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b7693e97a7e0de3c5fc1630616b4d217/href">https://medium.com/media/b7693e97a7e0de3c5fc1630616b4d217/href</a></iframe><h3>Class Types</h3><p>In some cases class inheritance might not be the way to go ⚠️, but interfaces can provide the consistency needed among classes. Mainly because interfaces explicitly enforce that a class meets a particular contract.</p><p>An interface defines a generic template (properties and methods) that will have to be implemented by the class, this is another difference with inheritance where the child class inherits the members from the parent class.</p><p>For instance, we can define an interface that would enforce the implementation of two methods, area and volume.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4e513454e518d7a061c243df0ed9e4f9/href">https://medium.com/media/4e513454e518d7a061c243df0ed9e4f9/href</a></iframe><p>Now we will implement this interface in a class:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/14baef914a17ed5c311183a7fcdd97f3/href">https://medium.com/media/14baef914a17ed5c311183a7fcdd97f3/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=961b841386bd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/angularmedellin/a-brief-introduction-to-typescript-part-4-961b841386bd">A Brief Introduction to TypeScript — Part 4</a> was originally published in <a href="https://medium.com/angularmedellin">Angular Medellin</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 Introduction to TypeScript — Part 3]]></title>
            <link>https://medium.com/angularmedellin/a-brief-introduction-to-typescript-part-3-b2b584da09d?source=rss----432a26e1c754---4</link>
            <guid isPermaLink="false">https://medium.com/p/b2b584da09d</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[class]]></category>
            <category><![CDATA[introduction]]></category>
            <dc:creator><![CDATA[Pablo Velásquez]]></dc:creator>
            <pubDate>Thu, 12 Oct 2017 07:16:40 GMT</pubDate>
            <atom:updated>2017-10-13T02:17:09.091Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Object-oriented programming</strong> (OOP) has been a very popular programming paradigm during the last decades due to its level of scalability and modularity 📚. Traditional JavaScript supports this paradigm but it uses prototypes for inheritance instead of classes, however latest versions of the standard introduced the possibility to use a class-oriented approach.</p><p>This new approach can be considered as <strong>syntactic sugar</strong> because it doesn’t change the existing prototype-based inheritance model, but allows a simpler way to create objects and manage inheritance. TypeScript allows us to use these techniques now without having to wait for the browsers to support them 🚀.</p><h3>Class declaration</h3><p>In OOP paradigm, a class represents the blueprint of an object or entity, it provides initial values for state and implementation of its behaviour. This representation allow us to create reusable components and TypeScript provides syntax that is very common in other object-oriented languages.</p><p>In general, a class is composed of a name, attributes and methods. The syntax to create a simple class looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4a3f561a6fe71a27cfc8f8c20c16a88f/href">https://medium.com/media/4a3f561a6fe71a27cfc8f8c20c16a88f/href</a></iframe><p>This class contains one attribute (name) and two methods ( constructor, greet).</p><p>Now that we have the blueprint, we can create several objects based on this class. When an object is created by the constructor of a specific class, this object is called an <strong>instance</strong> of the class.</p><p>We can create and initialize an instance of this class using its constructor as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/198ee6c5384b021735174324c6a51d74/href">https://medium.com/media/198ee6c5384b021735174324c6a51d74/href</a></iframe><p>Now that we have created john, we can use the behaviour implemented in the class. In this case, the greet method:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d4d69d7ef19de37945b7c4cb16839ffb/href">https://medium.com/media/d4d69d7ef19de37945b7c4cb16839ffb/href</a></iframe><p>The console output is: Hi! I&#39;m John Doe.</p><h3>Member variables</h3><p>In TypeScript, each class member (property or method) is public by default. This means that they are visible outside the class, even if they don’t have the explicit public label:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/51a45bc38f9494fd9400d0c6611214e6/href">https://medium.com/media/51a45bc38f9494fd9400d0c6611214e6/href</a></iframe><p>If we create an instance:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/44fd9768b2d98ccb1f81cb4bd3f905a1/href">https://medium.com/media/44fd9768b2d98ccb1f81cb4bd3f905a1/href</a></iframe><p>The console output is: John Doe. But since each member is public by default, we can access and change them outside of the class:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/01e5fc659abeb5fc5932c14b941e3bbc/href">https://medium.com/media/01e5fc659abeb5fc5932c14b941e3bbc/href</a></iframe><p>The console output is: Jane Doe, even if we created a person called John Doe. This free access to class members can be very dangerous if it’s not controlled ⚠️, that’s why TypeScript adds the possibility to have private members.</p><p>When a member is marked private, it can’t be accessed from outside of its containing class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8bf37b658cbfa9b5aaf399d573e4595/href">https://medium.com/media/d8bf37b658cbfa9b5aaf399d573e4595/href</a></iframe><p>The transpiler would alert us of this error with a message like: Property “name”is private and only accessible within class “Person&quot;.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/25f2767f084a81a1a7a945cf92cdca12/href">https://medium.com/media/25f2767f084a81a1a7a945cf92cdca12/href</a></iframe><h3>Class behaviour</h3><p>In the <a href="https://medium.com/angularmedellin/a-brief-introduction-to-typescript-part-2-8d13804591a2">last article</a> we developed some typed functions, mostly related with arithmetic operations, like add and multiply. We could create a basic calculator class with them 🔢 :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b0be8e1997f5cfc14c8e59c99991f2cf/href">https://medium.com/media/b0be8e1997f5cfc14c8e59c99991f2cf/href</a></iframe><p>Notice that we didn’t write function for the methods.</p><p>The behaviour of this class is defined by its methods, and we can expand these until we create a class that fully defines the behaviour that a basic calculator should have:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f5d0b18cef5bb438aedad00943f0e44c/href">https://medium.com/media/f5d0b18cef5bb438aedad00943f0e44c/href</a></iframe><h3>Inheritance</h3><p>One of the main features in OOP paradigm is the possibility to create new classes based on others using <strong>inheritance</strong>.</p><p>For instance, we would like to extend our basic calculator into a scientific calculator. Calculator would be our <strong>parent class</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f5d0b18cef5bb438aedad00943f0e44c/href">https://medium.com/media/f5d0b18cef5bb438aedad00943f0e44c/href</a></iframe><p>And we would like to extend from it into another class called ScientificCalculator, this would be the new <strong>child class</strong> that inherits all the properties and methods existing in Calculator. ScientificCalculator can also include additional properties and methods not included in the parent class.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2b584da09d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/angularmedellin/a-brief-introduction-to-typescript-part-3-b2b584da09d">A Brief Introduction to TypeScript — Part 3</a> was originally published in <a href="https://medium.com/angularmedellin">Angular Medellin</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 Introduction to TypeScript — Part 2]]></title>
            <link>https://medium.com/angularmedellin/a-brief-introduction-to-typescript-part-2-8d13804591a2?source=rss----432a26e1c754---4</link>
            <guid isPermaLink="false">https://medium.com/p/8d13804591a2</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[function]]></category>
            <category><![CDATA[introduction]]></category>
            <dc:creator><![CDATA[Pablo Velásquez]]></dc:creator>
            <pubDate>Sat, 07 Oct 2017 21:26:29 GMT</pubDate>
            <atom:updated>2017-10-08T20:16:55.334Z</atom:updated>
            <content:encoded><![CDATA[<p>Functions are one of the fundamental building blocks of JavaScript and they play a role that is so important that make them deserve the name of <strong>first-class citizens 🎩</strong>. So, let’s dig into what TypeScript functions have to offer.</p><h4>Named functions</h4><p>The syntax to declare a function in JavaScript follows a particular structure:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f140d5e7b56975e80157154275b28311/href">https://medium.com/media/f140d5e7b56975e80157154275b28311/href</a></iframe><p>For instance, if we would like to create a named function to calculate the sum of two given numbers, it would be like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fc268e7422c460dd068ec5c65de46b76/href">https://medium.com/media/fc268e7422c460dd068ec5c65de46b76/href</a></iframe><p>And if we test it with numbers it behaves as expected:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8a23dc691933cce13652a3da375dd097/href">https://medium.com/media/8a23dc691933cce13652a3da375dd097/href</a></iframe><p>But JavaScript allows to use this function with other datatypes, for example <em>boolean</em> and <em>string</em>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7af40e58e9edfc26c56bd0b74ae2c8bd/href">https://medium.com/media/7af40e58e9edfc26c56bd0b74ae2c8bd/href</a></iframe><p>And this is not bad <em>per se</em>… <em>but maybe, just maybe</em>… this could generate some unexpected behaviours when dealing with large scale projects. 🔥</p><p>This is why TypeScript adds new capabilities to these functions, one of them being the capability to declare the type of each parameter in order to create the signature:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d635ebc63ef4893ab70141297b92f2d9/href">https://medium.com/media/d635ebc63ef4893ab70141297b92f2d9/href</a></iframe><p>We can also add a return type, but TypeScript is able to infer it with the return statements:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e59540861035573668475672f7ee4106/href">https://medium.com/media/e59540861035573668475672f7ee4106/href</a></iframe><h4>Optional and Default Parameters</h4><p>In TypeScript, every parameter is assumed to be required by the function. This is very different from traditional JavaScript where every parameter is optional ❗. If we would like to have this optional parameters, we need to add them after the required parameters with ?:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/14b496b7b3f95559ab95362c7027ed1d/href">https://medium.com/media/14b496b7b3f95559ab95362c7027ed1d/href</a></iframe><p>In TypeScript, we can also set a default value for a parameter in case of not having a value provided or undefinedis passed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9996cbdf1e6f67a3c26e28bb453f4bb5/href">https://medium.com/media/9996cbdf1e6f67a3c26e28bb453f4bb5/href</a></iframe><h4>Anonymous functions</h4><p>If the function name is omitted in the function expression, it becomes an anonymous function. This kind of function is usually stored in a variable or used as an argument of another function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a156cf833a1a023c82041a9362a45653/href">https://medium.com/media/a156cf833a1a023c82041a9362a45653/href</a></iframe><p>When stored in a variable it ends with a semicolon because is part of an executable statement.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e83b988339774590006147d218340200/href">https://medium.com/media/e83b988339774590006147d218340200/href</a></iframe><p>As seen before, TypeScript gives the option to add types to each parameter and to the function itself with the return type.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1dc76f64cd65228f196f16010aa9baa4/href">https://medium.com/media/1dc76f64cd65228f196f16010aa9baa4/href</a></iframe><p>This is called <strong>anonymous function with type inference</strong>, but in the case that we would need to declare the full type of the function, it would be as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2e61acf811ebfef0b20d3e29b8b14909/href">https://medium.com/media/2e61acf811ebfef0b20d3e29b8b14909/href</a></iframe><p>In order to declare the type of the variable add the input and output types need to be declared. The input types are declared as (x: number, y; number)accordingly with the parameters of the function, and the output type is related to the return type numberpreceded by the =&gt; symbol.</p><h4>Arrow functions</h4><p>So far we have been seeing the functionkeyword a lot in the different declarations, and this is quite repetitive for a programming language that is <strong>functional</strong>. But TypeScript offers a simpler syntax to declare a function.</p><p>Let’s use one of the already studied functions:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a214ae1400c551fc3391191bfcc378c3/href">https://medium.com/media/a214ae1400c551fc3391191bfcc378c3/href</a></iframe><p>We can rewrite addas follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b3b17723d758bd067e2434aafb3f2e06/href">https://medium.com/media/b3b17723d758bd067e2434aafb3f2e06/href</a></iframe><p>This function declaration is called <strong>arrow function</strong> because of the =&gt; operator and is known in other languages as <strong>lambda function</strong>. In general, arrow functions can be declared as:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d60296a3b48ef92bfc011a45578958c9/href">https://medium.com/media/d60296a3b48ef92bfc011a45578958c9/href</a></iframe><p>If the statements consist in just one return statement, it can be simplified and return can be omitted:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/170a4eb05c380bea448f027206d6491f/href">https://medium.com/media/170a4eb05c380bea448f027206d6491f/href</a></iframe><p>We can add types to each parameter and the return type:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e000ca7606e98eaa89cb8fc5f44ad592/href">https://medium.com/media/e000ca7606e98eaa89cb8fc5f44ad592/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d13804591a2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/angularmedellin/a-brief-introduction-to-typescript-part-2-8d13804591a2">A Brief Introduction to TypeScript — Part 2</a> was originally published in <a href="https://medium.com/angularmedellin">Angular Medellin</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 Introduction to TypeScript — Part 1]]></title>
            <link>https://medium.com/angularmedellin/a-brief-introduction-to-typescript-part-1-ceedb3e9b1c0?source=rss----432a26e1c754---4</link>
            <guid isPermaLink="false">https://medium.com/p/ceedb3e9b1c0</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[introduction]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[type]]></category>
            <dc:creator><![CDATA[Pablo Velásquez]]></dc:creator>
            <pubDate>Tue, 12 Sep 2017 23:23:03 GMT</pubDate>
            <atom:updated>2017-10-07T21:48:43.792Z</atom:updated>
            <content:encoded><![CDATA[<p>TypeScript is a programming language designed for large-scale JavaScript application development, it has been designed as a <strong>typed superset of JavaScript</strong>. This means we’ve actually been writing TypeScript this whole time! 🎉</p><p>This language allow us to use features from the most recent <em>ECMAScript</em> versions and even some features that are not even in the scope of the standard. This is because when compiled, it produces JavaScript in a cross-platform safe version. TypeScript, currently in the version 2.5, adds features like optional static typing, classes, interfaces, modules, and many others. All of this allow us to use JavaScript from the future right now!</p><h3>But how does all this sorcery work?</h3><p>TypeScript needs something that transforms its syntax into standard JavaScript, this is called the transpiler, a type of compiler that takes the source code in a programming language as the input, and transforms it into another programming language.</p><p>TypeScript files have the .ts extension, and the transpiler produces the well known .js files.</p><p>TypeScript also allows the use of common JavaScript libraries and frameworks, by providing an easy integration with declaration files.</p><h3>Types</h3><p>One of the most controversial features of this language are its <strong>types</strong>, mainly because it seems to be sometimes an initial misconception of how they work and how strict their use really is. In order to clarify this, let’s start by reviewing our understanding of types.</p><h4>Dynamic Types</h4><p>JavaScript counts with <strong>dynamic types</strong>. This means that when you declare a variable, you don’t define the type:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aaeb450887be000d40d57b4654b0f6cb/href">https://medium.com/media/aaeb450887be000d40d57b4654b0f6cb/href</a></iframe><p>The type will be inferred during execution, this allows a variable to have different types:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fc7554cdc39dca738db17ebd6f01e285/href">https://medium.com/media/fc7554cdc39dca738db17ebd6f01e285/href</a></iframe><p>This apparently simple and convenient feature, can make the programming and debugging activities way more complex in the long run.</p><h4>Static Types</h4><p>This is what makes the whole difference, TypeScript adds optional <strong>static types</strong> to JavaScript, this means that you can declare a typed variable:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/51408bfb275f7cde00a63a6c70e1633f/href">https://medium.com/media/51408bfb275f7cde00a63a6c70e1633f/href</a></iframe><p>And the type of this variable will be the same in your development process thanks to the type checking at compile time:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/594728cd22bf59e1154d82c3190863f0/href">https://medium.com/media/594728cd22bf59e1154d82c3190863f0/href</a></iframe><p>The transpiler would alert us of this error with a message like: <em>Type “number” is not assignable to type” string”</em>.</p><p>TypeScript supports most of JavaScript types and it also adds some other new datatypes.</p><p>The most important thing to notice here is that the static types provided by TypeScript are optional, this means that even the core principle behind the language can be used based on convenience, unlike other static typed languages that enforce the use of types. And this separates TypeScript from other typed languages, for instance Java, where the use of types is very strict.</p><p>Even more, in case you decide not to adopt types, the types will be inferred by the transpiler.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6b02105fec6b01e4355da38c98c50e63/href">https://medium.com/media/6b02105fec6b01e4355da38c98c50e63/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FuPnKU86sFa2fm%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FuPnKU86sFa2fm%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FuPnKU86sFa2fm%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="290" frameborder="0" scrolling="no"><a href="https://medium.com/media/c308bab1a2331095bfaf8e2e8a8e6450/href">https://medium.com/media/c308bab1a2331095bfaf8e2e8a8e6450/href</a></iframe><p><strong><em>Can you see it?</em> </strong>I bet you can now!</p><p>Now let’s dig into what TypeScript types have to offer:</p><h4>Boolean</h4><p>Is similar to the Boolean JavaScript datatype, it represents logical values that can be true or false:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5c8abaf0e44061e590ac83b1508a8375/href">https://medium.com/media/5c8abaf0e44061e590ac83b1508a8375/href</a></iframe><h4>Number</h4><p>As well as in JavaScript, all numbers are floating point values. TypeScript supports decimal, hexadecimal, octal and binary literals:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ff1a53828ae4bf1c2f67d82203540a84/href">https://medium.com/media/ff1a53828ae4bf1c2f67d82203540a84/href</a></iframe><h4>String</h4><p>Like the well known string type in JavaScript, this datatype uses double quotes (<strong>”</strong>) or single quotes (<strong>’</strong>) to surround the text. A basic string variable declaration in TypeScript would be:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4b348c1593c2e8b6d8dd3413b184b6cb/href">https://medium.com/media/4b348c1593c2e8b6d8dd3413b184b6cb/href</a></iframe><p>or:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cde4127bc731c7a965406dce10526b84/href">https://medium.com/media/cde4127bc731c7a965406dce10526b84/href</a></iframe><p>TypeScript supports the use of <strong>template strings</strong>, these are multiple lines surrounded by the backtick/backquote (<strong>`</strong>) character.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9d0f4e32d0008dca58cbcb40bff98b73/href">https://medium.com/media/9d0f4e32d0008dca58cbcb40bff98b73/href</a></iframe><p>You can also have embedded expressions within a template string with the form <strong>${expression}</strong>, these allow you to have evaluated operations inside the string, also known as string substitution.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b63dc66504a56e31471a40824d3d5d6a/href">https://medium.com/media/b63dc66504a56e31471a40824d3d5d6a/href</a></iframe><p>In this scenario, the variable message as the following value:</p><p><em>TypeScript 2.5 says:<br>Hello!</em></p><p>These features enhance significantly the traditional JavaScript string datatype, and allow us to use modern capabilities that are well known in other programming languages.</p><h4>Array</h4><p>A typed array can be declared in two ways. In the first one, the datatype is followed by <strong>[]</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b60ce117380ae50ba8b56726e6fa9b56/href">https://medium.com/media/b60ce117380ae50ba8b56726e6fa9b56/href</a></iframe><p>In the second one, the generic array type is used with Array&lt;elemType&gt;:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3ce0f7b2bda078633cc5f9e24ce1a324/href">https://medium.com/media/3ce0f7b2bda078633cc5f9e24ce1a324/href</a></iframe><h4>Enum</h4><p>Is a special datatype and it allows a variable to be a set of predefined constants, giving a consecutive numeric value associated with each identifier.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a0849263e33a05c0c5f9fbbfd3b50193/href">https://medium.com/media/a0849263e33a05c0c5f9fbbfd3b50193/href</a></iframe><h4>Any and Void</h4><p>When we don’t know the type of the variable, we can use the type any, this means to mute the type checking but in some scenarios might be necessary, like when we deal with dynamic content or external sources.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d68262e8ff4290b21bf536b1abda4f8b/href">https://medium.com/media/d68262e8ff4290b21bf536b1abda4f8b/href</a></iframe><p>The absence of any type at all is represented by void, this is mostly used with functions and interfaces that we will see later.</p><h4>Other Datatypes</h4><p>TypeScript 2.x introduces new datatypes like: null, undefined and never. But for now we will avoid them in order to focus just in the common scenarios faced with static types.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ceedb3e9b1c0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/angularmedellin/a-brief-introduction-to-typescript-part-1-ceedb3e9b1c0">A Brief Introduction to TypeScript — Part 1</a> was originally published in <a href="https://medium.com/angularmedellin">Angular Medellin</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>