我想在另一个组件中调用某些函数,可以将其注入当前组件的构造函数中吗?
import { HomeComponent} from './../home/home.component';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
constructor(home:HomeComponent){
home.getSomeData()
}
}