Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70617

What is the better practice to pass data between the component and the main page

$
0
0

@thomaskim47 wrote:

Hi guys, I am confused about the data passing between the main page, and its components. Here is the example, I have this page call restaurant.ts, and inside it, I have 3 to 4 components like restaurant-detail-main.component.ts, restaurant-detail-info.component.ts.

I have a provider which has the whole array of object which contain only one restaurant, like
public restaurant: [
{
id: 1,
restaurantName: ‘Super Nice Cafe’
}
]

Okay, here is the main question in my mind,

  1. should I just inject the provider one time in the main restaurant.ts, and pass array to components.
  2. Or should I inject every time I need the data, whether in components or pages.

Appreciate your advice :slight_smile:

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 70617

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>