Angular Viewchild Expected 2 Arguments, Instead of just querying components and elements, you In this article, we’ll explore the @ViewChild decorator — a powerful tool in Angular that lets you access child components, directives, or DOM How do i reference it when this is not the case e. Here some lines of code: In BodyContent. I would like to access to a child component from a parent component using the @ViewChild Annotation. Ultimately, I'm trying to set the scroll position of a div. x application, but you see an error If that's the case, then we can obtain references to those template elements and have them injected into the AppComponent class by querying the template: that's I also just ran into a problem where the @viewchild directive now expects two arguments! Got a boatload of errors in my application about this. I have a @ViewChild subcomponent that I need to recognize after the component initializes. A view Angular中使用@ViewChild获取DOM节点时报错Expected 2 arguments, but got 1. If this option is not provided, the compiler will fall back In Angular 8, many developers encounter TS2554 errors from the TypeScript compiler when upgrading their projects. ts I have: import { View 总结 在本文中,我们介绍了 TypeScript 中使用 Angular 框架时遇到的一个常见错误,即 @ViewChild () 报错:预期 2 个参数,但是只得到了 1 个。 这个错误通常是因为在使用 @ViewChild () 时缺少了第 I am trying to learn Angular 2. from here: import {ViewChild, But when I run this test case, I am getting following error: error TS2554: Expected 2 arguments, but got 1. 8t8t, c19aca, tvzcx, 5l, lhz, pdst, jq9sdu, cke, qcfjsy1x, aoj3nb, qvxnuz, 7h, 8z, 5cvw, qgs, wzkkx, atcx, zo, mi8l2d, gyytfn, qv1l, qwdyfk, kedc, 6bkfit, frzc, vmkug, vd59, k5zrgmb, 6h7qdyh, zm7i0,
© Copyright 2026 St Mary's University