Hello I have 3 components in Angular 13: Child : Burger-menu Parent : Header Grand-Parent : app.component.html I have a close burger menu button in the burger-menu component. when I click on it, I want to remove a class that is on the header. The header is located in the grandparent component. Here is my code : Grand-parent component: app.component.html
Tag: angular13
let variable in angular ngif with multiple conditions
In Angular (13) is there a way to assign the result of a function to a variable (in the .html part of a component, not template) having multiple conditions in ngIf if not what workaround is possible to implement? Answer did not find anything better than splitting the ngIf in two
ViewChild is undefined in angular 13
I am trying to call view child of a child component from parent and getting undefined in the console. see the image also see the stack blaze for the same https://stackblitz.com/edit/angular-ivy-k4m2hp?file=src%2Fapp%2Fhello.component.ts Please help to get the child component this.testChildComponent So that i can call ngOnInit of child from parent. this.testChildComponent.ngOnInit() Answer if you set your viewChild { static: true }
What is the proper way to update a parent component with a shared service in ngOnInit – Angular 13
I’ve come across a situation a few times where I use a shared service in a component’s ngOnInit to update a value in another component, which just so happens to be a parent. This results in the infamous Error: NG0100: Expression has changed after it was checked in development mode, and change detection will not pick up the change. I
Unable to call a JS function from Typescript in Angular 13
I’m trying to call the following function, LoadMultiSelect(), from one of my components because I am using a non-Angular library: https://ibnujakaria.github.io/multiple-select-js/ This works perfectly in the console: And loads the JS component. Later, I try adding it in Angular, but I cannot find how to. I tried to export the JS function in two ways: And like this: I created