Having this People array be in line will work for now, but we should probably extract it out into a class. To do this, we'll use the Ionic-CLI's generate command.
Let's open up a new terminal. We can run the command ionic g provider People. This will create a prebuilt provider for us in the source provider's folder.
In home.ts, let's remove the original array of People.
We'll then open up our newly-created provider, people.ts. We'll then create a new property of People, and then set its value to our original array.
Then we'll create a method called getPeople and have it return the array of this.people.
Now, we'll want to open up our app.modules.ts file. We'll import our newly-created provider from providers People, and then import that class People.
Then we'll make sure to add it to the providers array of our NgModule.
We can now go back to our home.ts file. We'll import the People's provider again from our providers/people and import the class People.
We'll head down to our constructor and inject a service with a type of People. We can finish it by saying our property of People is going to equal this.service.getPeople.
We can then save and have our data still be updated, just getting pulled from our service. Now, the CLI's generate command can create more than just providers.
We can see all the available generators by running ionic g --list. We can create components, directives, full pages, types, and as well as generator for creating the full tabs layout.