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.

Using a data model interface

Using a data model interface - Ionic Tutorial

From the course: Ionic 4.0 Essential Training

Start my 1-month free trial

Using a data model interface

You might be wondering what should we do with the interface? Well, here's what we're going to do. We are going to make sure that our two methods, get activity and get all activities are returning the correct type of data. Remember what I said earlier? an observable is returned. Now we're going to type cast this observable and say, it is of type observable, and hit enter. And this observable type is of type activity, and hit enter. Now at this point in time, it is worth noting that I am leveraging on Visual Studios ability to automatically import specific things for me. For example, if you look at line three and line four, just by merely typing the observable, Visual Studio Code was able to import The same thing happened on line four, was able to detect and import the activity interface for me. you will need to manually write these lines of code. The next thing we're going to go and do our get activity function says that it will be returning an observable of type activity, the HTTP…

Contents