I have developed two components that are both utilizing 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();
}
}
Whenever I try to run it, I encounter an error saying "No provider for Component A."
If you have any insights or alternative ways to approach this issue, please let me know. My objective is to pass data from Component A to Component B so that when Component B is pushed to the front, I can view that data.