Skip to content

📋 Angular App to get user data from an external JSONPlaceholder API.

License

Notifications You must be signed in to change notification settings

AndrewJBateman/angular-httpclient-module

Repository files navigation

⚡ Angular API User Posts

  • App to get user data from an external JSONPlaceholder API.
  • 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

  • Angular httpClient used to get API data.

📷 Screenshots

Example screenshot.

📶 Technologies

💾 Setup

  • npm i to install dependencies
  • 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.

💻 Code Examples

  • data.service.ts using httpClient service with a getUser() function to get user details from the API.
export class DataService {
  apiUrl = "https://jsonplaceholder.typicode.com/users";

  constructor(private _http: HttpClient) {}
  //get array of users from API url
  getUsers(): Observable<User[]> {
    return this._http.get<User[]>(this.apiUrl);
  }
}

🆒 Features

  • Angular httpClient used to get data from an external API.
  • simple angular pipe used: {{ user.name | uppercase }} to convert username to uppercase.

📋 Status & To-Do List

  • Status: Working.
  • To-Do: Nothing

👏 Inspiration

📁 License

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

✉️ Contact