I have two components both using the same Service I created
#Component A
@Component({
templateUrl: 'build/pages/templateReunionCourse/templateReunionCourse.html',
providers: [
ReunionService,JSONP_PROVIDERS
]
})
export class Reunion{
month: any;
constructor(private loadingController: LoadingController,private navCtrl: NavController, public reunionService: ReunionService, public cmpB: ComponentB)
{
this.month = new Date().toDateString();
}
onClickItem(string: any){
this.cmpB.data=string;
this.navCtrl.setRoot(Courses);
}
}
#ComponnetB @Component({ templateUrl: 'build/pages/courses/courses.html', providers: [ReunionService] }) export class Courses { Date: any; data: any; constructor(private loadingController: LoadingController, private navCtrl: NavController, public courseService: ReunionService) { this.Date = new Date().toDateString(); this.presentLoading(); this.loadRaces();
}
}
When I attempt to Run. I get the error No provider for Component A
Any insight or alternative approach would b appreciated. My goal is to set data in component B from Component A so that when I push component B to Front I can view that data
Well I am back took me a while but I solved the Issue with what I think is better practice. I created a view-less Component. created the variable I wanted to aces So this current view-less component acts like a bus(bridge) between the Components. then Ionic bootstrap them in my parent Component while Injecting in the Child. it stores the state of the resources . If code help is needed by anyone on that just ping