Coder Social home page Coder Social logo

angular-2-refactor's Introduction

Note: This will be a pair programming activity. Please select one developer's machine to work on, but make sure you share your code with your partner before leaving class.

Angular 2 Refactoring Lab

Set Up

First, fork and clone this repo.

In the starter-code folder, you will need to run bower install to install your dependencies.

Then, start your simpleHTTPServer with python to see a fully functioning Angular app. Cool, right? But not very modern.

Throughout this lab, we will slowly turn our Angular 1 app into an Angular 2 app, using our good friend, refactoring.

If you get stuck, you should use this guide on the Angular 1 and Angular 2 code differences, as well as a healthy amount of Google, and a little bit of help from your neighbors.

Before you move on to the next step, take a quick look at the starter-code folder, and observe the differences between files and folder structure vs Angular 2+.

Set Up Round Two

Use ng new to set up a local Angular 2+ app called updated-project. The app folder you create with this command should be at the same level as starter-code. Start up this new app. We've got a lot of work to do....

Getting Started

The amount of files in this project is a little daunting, but you only need to worry about a few files. Start small, and gradually add in new features from starter-code into updated-project.

  • Now, the fun part. Slowly add the pieces of your Angular 1 app from starter-code/index.html to updated-project/src/app/app.component.html and from starter-code/client.js to updated-project/src/app/app.component.ts. You will need to change the code slightly for most of these ports. You can find the code you'll need to do this in this guide.

Hint: You will definitely want your Developer Tools console open to help you target which things to change.

  • In addition to app.component.ts and app.component.html, you may also need to change app.module.ts as you go through this refactoring to include other helpful library/ies.
  • Once you have all the HTML in app.component.html, move the code from cartoonStyle.css into the stylesheet of your App Component.
  • Finally, see if you can get MyFactory injected into your component as a service.

Deliverable

When you are finished, you should be able to look at your Angular 2 and Angular 1 apps side-by-side and see no major differences.

angular-2-refactor's People

Contributors

zebgirouard avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.