Angular 4调用2个组件

时间:2017-09-29 10:04:37

标签: angular

我有两个组成部分:

UserComponent:

export class UserComponent {

@ViewChild(ProfileComponent)
profileComponent:ProfileComponent;

constructor(private userService: UserService, private confirmationService: ConfirmationService,private messageService: MessageService) {}
}

ProfileComponent:

export class ProfileComponent {

@ViewChild(ProfileComponent)
userComponent: UserComponent;

constructor(private profileService: ProfileService, private confirmationService: ConfirmationService,private messageService: MessageService) {}
}

我想在UserComponent中使用ProfileComponent并在ProfileComponent中使用UserComponent,但它无效。

0 个答案:

没有答案