Coder Social home page Coder Social logo

giphy-the-angular-workshop's Introduction

Angular week 2 Live Coding Workshop

  • This was a live coding session to do a recap on some of the content the students covered in angular CLI week 2.

Discussed Topics

  • Introduction to consuming simple REST APIs.
  • Introduction to Routing Module .
  • Introduction to Dependency Injection and Services.
  • Introduction to HttpModule & HttpClient using promises.
  • Passing parameters to routes

Giphy API

1. Creating App, Navbar and Basic Routing

  • Checkout to this branch to see the all the code in this section
git checkout 1.creating-navbar-and-basic-routing

Created our app and installed bootstrap

ng new giphy
cd giphy
npm install bootstrap

src/styles.css

@import  '~bootstrap/dist/css/bootstrap.min.css';

Created the parent component GiphyComponent

  • create GiphyComponent
cd src/app
ng c giphy

Created basic navbar

  • First created navbar component GiphyNavbarComponent
ng g c giphy-navbar

file: src/app/giphy-navbar/giphy-navbar.component.html

<nav  class="navbar navbar-expand-lg navbar-dark bg-dark">
	<a  class="navbar-brand"  href="#">Giphy</a>
</nav>

file: src/app/app.component.html

<app-giphy-navbar></app-giphy-navbar>

<div  class="container">
	<router-outlet></router-outlet>
</div>

created a not-found component

  • create a not-found component
     ng g c not-found

file: src/app/not-found/not-found.component.html

<h2>Error 404</h2>

Added basic routes

file: src/app/app-routing.module.ts

....
import {GiphyComponent} from  './giphy/giphy.component'
import {NotFoundComponent} from  './not-found/not-found.component';
....
const  routes:  Routes  = [
{"path":"home","component":GiphyComponent},
{"pathMatch":"full","redirectTo":"home","path":"" },
{"path":"**","component":NotFoundComponent},
];

2. Gif Search Form and Emitting To Parent Component

  • Checkout to this branch to see the all the code in this section
git checkout 2.Gif-Search-Form-and-Emitting-To-Parent-Component

Create A basic gif search form

ng g c giphy-search-form1.creating-navbar-and-basic-routing

Bind the Input field to a variable in the component

Emit search event to parent component

3. Creating a http service for giphy and store results from API

  • Checkout to this branch to see the all the code in this section
git checkout 3.Create-http-service-for-giphy]

Create Service, Inject to Parent Component

ng g s services/giphy-http-service

Import httpmodule and make http request with promise.

Store results from API

4. Displaying results

Display search results and show default gifs on homepage

Resources

  • todo

giphy-the-angular-workshop's People

Contributors

jakhax 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.