所以,我安装了Node.js,现在当我尝试安装Mongoosejs时,我收到一个错误,告诉我我没有所需的Node.js版本(我需要v0.4.11和v0.4.12).
我该如何升级到这个版本?我想我可以用最新版本再次安装它,但我不想在确定我的项目文件夹"node"中的项目文件夹不会被删除之前这样做.
通常,在建立团队的过程中,我遇到了合并冲突,package-lock.json而我的快速解决方案一直是删除文件并使用重新生成文件npm install。我尚未认真考虑此修复程序的含义,因为它以前没有引起任何可察觉的问题。
删除文件并以npm这种方式重新创建而不是手动解决冲突是否存在问题?
我试图从父组件调用子组件的视图子组件,但在控制台中未定义。
查看图像还可以看到相同的堆栈火焰
https://stackblitz.com/edit/angular-ivy-k4m2hp?file=src%2Fapp%2Fhello.component.ts
import { Component, Input, OnInit, ViewChild } from '@angular/core';
import { TestChildComponent } from './test-child/test-child.component';
@Component({
selector: 'hello',
template: `<h1>this is Hello component {{name}}!</h1>`,
styles: [`h1 { font-family: Lato; }`],
})
export class HelloComponent {
@Input() name: string;
@ViewChild('TestChildComponent') testChildComponent: TestChildComponent
ngOnInit() {
console.log('calling ngOninit in hello component');
console.log('going to call test child instance this.TestChildComponent.ngOninit')
console.log(this.testChildComponent);
}
}
Run Code Online (Sandbox Code Playgroud)
请帮忙获取子组件
this.testChildComponent
这样我就可以从父级调用子级的 ngOnInit 。
this.testChildComponent.ngOnInit()