3
這裏我有2個分量像CacadingComponent而LoginComponent我想消費在LoginComponentAngular2如何使用一個組件功能在另一個組件
CacadingComponent功能CacadingComponent
export class CascadingComponent {
CountryList: Country[];
constructor(private _CacadeService: CascadindService) {
}
GetCountry() {
return this._CacadeService.GetCountryList().subscribe((data) => this.CountryList = data);
}
LoginComponent.ts
這裏我想調用GetCountry()函數在我的LoginComponent中
export class LoginComponent{
//Here How can I call
}
您可以使用一個服務,如果你想擁有共享功能等 此外,您還可以使用組件視圖中的組件。 –
是@Dawid但要求是不同的 –