From the course: Ionic 4.0 Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Generating services - Ionic Tutorial
From the course: Ionic 4.0 Essential Training
Generating services
- [Instructor] At some point in this course, we are going to need to access and fetch real data for our activity and then showcase this real data inside of our own application. In preparation for that, we will need to create a service for this. The reason why we would want to create a service for this is so that we don't have all that code in the typescript of our component. Now we can easily open up our tab1 typescript page, which is tab1 page.ts, and make all that fetch request here. However, this is not a good practice. The reason why this is not a good practice is any time we need to use the same data we then have to make the same http call all over again. Now to solve this problem, it's best that we use the service pattern by creating a service where we can put all that logic inside of that service so that we can call that service from anywhere in our application and access the same data. This is also good for testing so that when you want to test our code, we can just test it…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Overview of Ionic UI components5m 35s
-
(Locked)
Designing the home page with cards8m 16s
-
(Locked)
Generating services4m 40s
-
(Locked)
Consuming REST APIs4m 16s
-
(Locked)
Consuming REST APIs: Implementing methods3m 3s
-
(Locked)
Creating a data model and interface4m 6s
-
(Locked)
Using a data model interface3m 54s
-
(Locked)
Finalizing the home page design10m 2s
-
-
-
-
-
-