Angular/RxJS When should I unsubscribe from `Subscription`

When should I store the Subscription instances and invoke unsubscribe() during the ngOnDestroy life cycle and when can I simply ignore them? Saving all subscriptions introduces a lot of mess into...

Angular2: get the count of child components - when in the lifecycle and how

So, for illustration purposes lets say I have two components tabset tabitem where tabset is the parent that has many tabitems tabset - tabitem1 - tabitem2 - tabitem3 -...

Animation for carousel with ng-boostrap and Angular 2

I am using the carousel component with ng-bootstrap. I understand there's an open issue for a proper animation feature that works correctly with the angular 2 component life cycle right now...

Angular 2 Spring Security CSRF Token

Hi Everyone I'm having trouble setting up a security solution for my app!! So I have a REST API Backend which runs at http://localhost:51030 and developed with Spring Framework, and for the front...

How does angular actually trigger the life-cycle hooks?

in a component life-cycle we have different interfaces that track different stages in the component life-cycle, ex. OnInit, OnChanges, OnDestroy..etc at the run-time how does angular trigger those...

Angular 4 component lifecycle

I am trying to use the component life cycle hooks that are exposed by Angular 4 to process certain information related to the component. When I tried to search I was able to find the list of life...

Angular 5 - lifecycle hook in directive

I am new to Angular 5. I have created the directive for the external JS library. But in the same directive, I am binding value to the attribute. I am trying to sue ngAfterViewInit to detect...

Angular set component styleUrls dynamically

I am using the latest version of angualar 5.0 in the new project. And i am new to this framework and would appreciate some help from the angular developers. I would like to set the styleUrls...

Angular life-cycle events call without implementing interface?

I am working with angular application and I found that angular life cycle events is call without implement interface.In below example if i remove interface from component then all the angular...

Angular: AfterViewInit() vs AfterContentInit()

I am trying to understand exactly what causes the AfterViewInit() and AfterContentInit() life-cycle hooks to fire. From the Official Angular Documentation it says for AfterViewInit() Angular...

Angular 6 - Behaviour Subject: get data to stay after refresh

I'm trying to pass data between course-detail component and course-play component. I used shared service and BehaviorSubject. The data is passing correctly to course-detail through the service,...

Angular 7 - View Child Still Returns as Undefined After Child Component is Initialized

I have a component that is utilizing a View Change subscription to watch for changes in a form checkbox. When the checkbox changes to true, the child component's form is to be set to disabled and...

data is not updating on page after routing to same url with different params

Basically I have a notification component that show notification on click of icon in header. When we click the icon on header, it opens a popup and shows a list of notification. On clicking any...

Angular 7 on same url navigation problem?

Problem statement :- when i am navigation to same url the ngonInit or any other life hook cycles dont work in angular . Scenario :- i am having a lazy loaded generic module in which content...

Real UseCases for ngDoCheck (Angular9)

I am a beginner in Angular & learning by myself and i have stucked in ngDoCheck life cycle method According to Documentation: Detect and act upon changes that Angular can't or won't detect on...

What happen if i use ngOnInit method without implementing OnInit interface

Can anyone please tell me what will happen if I don't implement onInit interface and still using ngOnInit component lifecycle inside a component? Since I used ngOnInit lifecycle hook without...

Simple state management in Angular?

I'm learning Angular from the very beginning, and coming from React, I can't find a way to manage a simple state in Angular. It's a simple todo app, and my strategy is to create a Todos array in...

Angular web component (elements) input is undefined in ngOnInit

I am building a web component in Angular. My objective is to evaluate if the consumer of the web component provided a given input, in this case "accessToken". However the input is undefined in...

How to prevent Angular child component ngAfterViewChecked on parent mousemove event?

I noticed that ngAfterViewChecked of child components are always triggered when I catch the mousemove event from the parent component even if the event does not change data. How to prevent that...

Using Angular Async Pipe to Subscribe to Observable

I am successfully subscribing to an observable in a couple of different components in my Angular/Ionic app. However, because I am doing so manually, that also means I need to manually unsubscribe...

Angular 2+ Browser Back Button doesn't reload child route

When clicking the back button sometimes the previous page reloads everything as expected and sometimes the previous page does nothing as though it is cached. There is no caching on the page. No...

Right way to use State management with NGXS in angular

I am a BE dev and now I'm learning Angular 6. I'm really interested in State management using NGXS. I have several concerns with an example below: I have an endpoint which return a set, about...

Ionic 5 / Angular 9: @mauron85/cordova-plugin-background-geolocation, doesn't start()

I can't figure out why this plugin doesn't work in my app: https://ionicframework.com/docs/native/background-geolocation My code:...

Run a component function every time its rendered

I've got an Ionic Angular app that calls an API every time the view changes and stores the value in ionic storage. Every page has a 'header' component that is supposed to display this value from...

Angular 10: ngOnInit not firing in the deployed app version in Firefox when navigating back from the external URL with browser's back button

I see that the life cycle of the deployed Angular application looks different in Firefox. There is a pretty trivial code of the app component: export class AppComponent implements OnInit { ...

Integrate Google Optimize in Nuxt application

I am trying to use Google Optimize in my Nuxt application. I need a way to fire an activation event after any of the page components gets updated. The problem currently is there can be data that...

NGXS: Property 'stream$' is used before its initialization

At first glance, it seems a default behavior of angular component life cycle logic that because of component properties did not initialized yet so stream$ cannot have assignment before component...

On change of input field in step 1 reset values in step 2 of mat stepper

I am using Angular material stepper for my application. Each step has individual components. parent.html: <mat-horizontal-stepper [linear]="isLinear" #stepper> <mat-step > ...

Unhandled GraphQL subscription error, when using apollos subscribeToMore method in an angular chat component for subscription

Problem Description I have a chat component in angular that gets messages from the backend via a graphql query. On the same query, I subscribe to updates when a new message is added via a graphql...

Angular OnPush change detection strategy performance

My understanding of angular change detection strategy from various articles and stackoverflow posts: The change detection process includes: Updating inputs to children of a component. Run change...