Questions tagged [viewchild]

ViewChild is a decorator for Angular component variables, which allow to bind a template element.

ViewChild is a decorator for Angular component variables, which allow to bind a template element. Official Angular documentation here: https://angular.io/api/core/ViewChild.

437 questions
0
votes
1 answer

how to loop through a div which contains multiple div using angular2

I have requirement where the user will be asked a series of questions from 1-5 and the questions will come in a loop like first the user answers first question and then clicks next to the next question and he can also go to the previous question…
user7161814
0
votes
0 answers

Dynamic component loading in angular 2

I was using dynamic component loader to read the component names from an array that is populated by a service and then load the components on the page. I was using loadIntoLocation method of the API but as it's not present in the latest version of…
DaWanderer
  • 75
  • 7
-1
votes
2 answers

Cannot read properties of undefined (reading 'nativeElement') In Angular

Hi While using ElementRef in Viewchild() I am facing an error. Please see the below error and let me know what is an issue. I also used ngAfterViewInit() but this error can not be resolved. import { Component, OnInit,ViewChild,ElementRef,Input }…
Rakesh Saini
  • 660
  • 2
  • 7
  • 20
-1
votes
1 answer

Access dynamically loaded child component instance

@ViewChild(ComponentType) comp!: ComponentType; ngAfterViewInit() { console.log('ComponentType instance', comp); } To get hold of a child component's instance, I know that ViewChild can be used as shown above. It works for statically added…
karthikaruna
  • 3,042
  • 7
  • 26
  • 37
-1
votes
3 answers

What is the difference between component selector and query selector in Angular ViewChild

According to Angular ViewChild Documentation, ViewChild Selector can the Component Class or a query string. Same result can be achieved with both. So what is the difference between these two, when to use what and performance wise which is better to…
Shantanu
  • 31
  • 4
-1
votes
1 answer

@ViewChild can't access properties of child component in Angular

I have a child and a parent component. In the child I have defined a property which I want to access via the @ViewChild directive and console.log its value. But I always get the type is not defined error. What am I missing? I also use the…
Kauabanga
  • 25
  • 6
-1
votes
1 answer

How to create reusable component with custom buttons configuration

So currently I have component which have multiple buttons configurable with options: test.component.html
-1
votes
2 answers

Angular component in NgbModal cannot use @viewchild to access methods inside

Im having the following problem, i think its a common case but i havent been able to solve it. I have a small error alert component, which has a method inside to show an error. The way im using it in route components is i use the @viewChild query to…
-1
votes
2 answers

How do I use replaceWith to move explanation text in place of question and remove the original div?

I'm building a quiz app in Angular and I've "moved" the explanation into the question box using replaceWith, but now I need help with hiding the original explanation below the correct answer. replaceWith should occur only when the correct answer is…
integral100x
  • 332
  • 6
  • 20
  • 47
-1
votes
1 answer

Angular: Cannot read property 'sendClassForm' of undefined inside ng-template of NgbModal

Alright, first, I've already searched this problem like mad and found some solutions (some explained here), but none of them explain an efficient way to do it. So, here I go... What this is about I'm creating a modal which uses ng-bootstrap. I made…
-1
votes
1 answer

No access to child component

I have 2 components. The first app-aaa hasapp-bbb inside. aaa-component.html: aaa-component.ts: …
609tom
  • 297
  • 1
  • 3
  • 14
-1
votes
1 answer

How to get the value of dynamically created input in angular

I have created an empty hash map of a 'question' object in angular according to the no. of questions given in the earlier page.Then i am rendering the 'question' objects in the hash map when the page initializes.I want to get the values of the…
Kalana Dananjaya
  • 100
  • 2
  • 14
-1
votes
1 answer

Dynamically Call Child Component Methods

I have requirement to export table where I have presented my custom tables using ngFor. When I was trying to export each table individually I got wrong result(only one table is exporting for every time) I had taken ViewChildren help. My Code is like…
Rama Krishna
  • 645
  • 10
  • 28
-1
votes
1 answer

Angular, Generate Tag with ngFor loop and get it with ViewChild

I have a problem... Actually I'm working on a grid I generated it, this part works. But now I need to retrieve the position and I would like to use viewChild with a tag Like below : Map.html: Map.ts: I know that ideally I should create my…
Chris
  • 41
  • 6
-1
votes
1 answer

Cannot import child component to parent component

I am using Angular 5. I want to call the child component method from parent component. For this I am adding the import {myChildComponent} from './myChild/myChild.component'; //ERROR: Cannot find module ./myChild/myChild.component How can I import…
user2480755
  • 97
  • 3
  • 11
1 2 3
29
30