Skip to content

Instantly share code, notes, and snippets.

@gregoryanderson
Created November 3, 2019 21:28
Show Gist options
  • Save gregoryanderson/29f24036319ef9ac0d4644dfe12a6ee6 to your computer and use it in GitHub Desktop.
Save gregoryanderson/29f24036319ef9ac0d4644dfe12a6ee6 to your computer and use it in GitHub Desktop.

I chose to push myself with investigating Angular.

I have come to realize that almost everything comes with a short tutorial on how to create an 'Ideabox' with their application. So, first I googled Angular tutorial and, lo and behold, there was a very familiar tutorial. I needed to install Angular globally and all of those commands are parallel to what is run in React. In fact, React and Angular build a full working app from creation that will run. There are more similarties as well in that they both use components and the standard component build is named 'App' by default. But we also start seeing some differences early on, too. For instance, React uses Javascript by default, but it seems as though Angular uses Typescript. In order to understand this change, I spent a few minutes researching the differences between TS and JS.

So, the understanding that I came away with is that Typescript is a little more strict than Javascript and can actually be used in React, as well, it is just not there by default like Javascript. It also seems like Typescript, at its heart, is Javascript and supports all of the Javascript libraries and may be used anywhere that Javascript would be used. Its advantages seem to exist within the compiling phase of an application and Typescript seems to be quicker and better at getting you a useful error. The general downsides of Typescript as opposed to Javascript are that it takes time to compile and does not support abstract classes.

Then I realized that Angular and React are actually not as similar as they seemed. While they both table set applications for front-end developers, React is a library and Angular is a framework. Angular offers true MVC architechture, whereas, React cannot do that from npx create-react-app. You may customize React to do this by adding Redux, but Angular offers it upon creation. Another big difference is the Angular's two-way binding as opposed to React's one-way. When a user changes the input the model changes as well. When the model is changed, the UI does as well. React depends on rerendering for this.

Something that I picked up that is specific to Angular is 'pipes'. According to the Angular docs, pipes are, "a way to write display-value transformations that you can declare in your HTML". A pipe is usually formatted in the element tag and effects the style of the output. The two instances that I came across were, 'uppercase' and 'date'. Uppercase transforms all letters to their uppercase form and date transforms date outputs into the specific model that you express.

Resources:

Difference Between Typescript and Javascript

React vs Angular

Angular Tutorial

Typescript Wiki

Angular Wiki

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment