Some question about Ionic 2

Hello,

i am introducing me to ionic 2 and i have some questions…

  1. What is the difference between @App, @Component, @Page?, well so much tutorials use these in the same way. I undestand that these are decorators but, when choose what? For example in one tutorial show this:
    ... @Page({ templateUrl: 'build/pages/profile/profile.html', }) export class ProfilePage ...

in another this:
... @Component({ templateUrl: 'build/pages/profile/profile.html', }) export class ProfilePage ...
and in another:

... @App({ templateUrl: 'build/pages/profile/profile.html', }) export class ProfilePage ...

then i dont know what is the best way or correct way.

  1. What is the difference between Provider and Service? About this i haven’t idea…

Thanks in advance and if there are documentation about this, please shere link :smiley: Thanks.

@Page, and @App where special types of @Component’s that Ionic provided, but they don’t exist anymore. All pages now use @Component, and the root component also uses @Component (previously @App). Tutorials that reference @Page and @App were built for an older version of Ionic 2.

A provider and a service are different names for the same thing, they are just some bits of helper code that do something for you, like fetching data from an API.

1 Like

Thank you so much… then with @Component is enought…

And when the tutorials mention a service, i can use ionic g provider …