Ionic beta8 global component


#1

Hi, is there a way to declare a component directive as global, in a way that you dont need to do a

directives: [component1]

in each page component.
the case before(beta6) was that when you include a component and declare it as directive in app.ts you dont need to re-declare it in each page.


#2

You could use bootstrap.


#3

What xr0rmaster says, include the directive inside the bootstrapping process instead of declaring it on the app as a directive. I.e. like this:

ionicBootstrap(ConferenceApp, [ConferenceData, UserData], {
  tabbarPlacement: 'bottom'
});

For an example of an Ionic2 beta .8 app check out the conference app.


#4

Hmm, i think i got confused. it was stated thats for providers. ill test it.

thanks for the response :slight_smile:


#5

Hey yall, so the correct answer would be to use the directives property on the root component.

@Component({
  template:.....,
  directives: [Comp1, Comp2]
})

Plus importing them into the root component.


#6

@mhartington

Using the directives property in the root component no longer works after upgrading to beta 8.