GithubHelp home page GithubHelp logo

andrewjbateman / angular-bootstrap-info Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 2.53 MB

:clipboard: Angular app to get API data and display it using Bootstrap styles

License: MIT License

JavaScript 14.41% TypeScript 71.47% HTML 14.12% SCSS 0.01%
angular bootstrap rest-api json-api news rxjs rxjs7 bootstrap5 angular16

angular-bootstrap-info's Introduction

โšก Angular Bootstrap Info

GitHub repo size GitHub pull requests GitHub Repo stars GitHub last commit

๐Ÿ“„ Table of contents

๐Ÿ“š General info

  • Free news from the mediastack REST API supplied in JSON format
  • take(1), tap() and map() methods used to extract API data.
  • Angular Async subscribe pipe used directly with the news response observable in the html template as it is auto-unsubscribing, instead of an observable subscription.

๐Ÿ“ท Screenshots

Example screenshot

๐Ÿ“ถ Technologies

๐Ÿ’พ Setup

  • Install dependencies using npm i
  • Get an API key using Mediastack Quickstart
  • Add API_KEY to environment.ts files
  • Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files. Note: This will not work with Mediastack due to restrictions using http. See this Stackoverflow for ways around HTTP restriction. I created a build file then opened index.html using Live Server.
  • Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.
  • Run ng update to update Angular

๐Ÿ’ป Code Examples

  • info.service.ts HTTP request returns an observable data stream that I tapped using console.log
    return this.http.get<ApiResponse>(apiUrl).pipe(
      take(1),
      map(res => res['data']),
      catchError(err => {
        throw 'an error occured: ' + err;
      }),
    );

๐Ÿ†’ Features

  • Use of Angular async pipe in HTML template reduces amount of code and auto-unsubscribes from the news data observable

๐Ÿ“‹ Status & To-Do List

  • Status: Working
  • To-Do: Add transloco, images? Change API? Add pagination??. Add click to data detail page.

๐Ÿ‘ Inspiration

๐Ÿ“ License

  • This project is licensed under the terms of the MIT license.

โœ‰๏ธ Contact

angular-bootstrap-info's People

Contributors

andrewjbateman avatar

Watchers

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