Angular 2 CRUD in Angular2 with Restful API


  • @Injectable() // Tells dependency injector to inject dependencies when creating instance of this service.

  • request.subscribe() // This is where you actually make the request. Without this your request won't be sent. Also you want to read response in the callback function.

  • constructor(private wikiService: WikipediaService) { } // Since both our service and it's dependencies are injectable by the dependency injector it's a good practice to inject the service to component for unit testing the app.