Stats

520 Contributors: 2 Sunday, October 9, 2016
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap

CRUD in Angular2 with Restful API

Syntax

  • @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.

Related Examples