/angular-datastream-feed

:clipboard: Angular app that uses RxJS asynchronous code to show Reddit search results in HTML

Primary LanguageTypeScriptMIT LicenseMIT

⚡ Angular Datastream Feed

  • Angular app that uses RxJS asynchronous code to show Reddit search results in HTML
  • Note: to open web links in a new window use: ctrl+click on link

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

📄 Table of contents

📚 General info

  • Code from Angular Boot Camp tutorial (see Inspiration below) on correct use of RxJS

📷 Screenshots

Example screenshot

📶 Technologies

💾 Setup

  • Install dependencies with npm install.
  • Run app using ng serve then navigate to http://localhost:4200/.

💻 Code Examples

  • reddit-search.component.ts function using RxJS switchmap to combine 2 observable data streams and return a new observable
    this.results = combineLatest([validSubReddit, validSearch]).pipe(
      // This logs the user's intended search
      tap(search => this.logger.log('Search for: ' + search)),
      // take an input observable, return a different observable
      switchMap(([subReddit, search]) =>
        ris.search(subReddit, search).pipe(
          retry(3),
          // Clear previous entries while waiting
          startWith([])
        )
      )
    );

🆒 Features

  • RxJS methods reduce unnecessary HTTP data requests

📋 Status & To-Do List

  • Status: Working but with strict mode turned off
  • To-Do: Correct types and reactivate strict mode.

👏 Inspiration

📁 License

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

✉️ Contact

  • Repo created by ABateman, email: gomezbateman@yahoo.com