Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Error ApplicationRef.tick is called recursively when injecting SkyModalService in a component that is shown using ngIf #744

Closed
Blackbaud-PaulCrowder opened this issue May 30, 2017 · 3 comments
Assignees

Comments

@Blackbaud-PaulCrowder
Copy link
Member

Blackbaud-PaulCrowder commented May 30, 2017

Expected behavior

A component that is shown using the Angular ngIf directive should allow SkyModalService to be injected in its constructor.

Actual behavior

Adding SkyModalService to the constructor of a component that is shown using ngIf causes the error ApplicationRef.tick is called recursively

Steps to reproduce

  • Create a component that has SkyModalService in its constructor.
  • Cite this component in another component with an ngIf directive.
  • The error occurs
  • Add SkyModalService to the parent component and the error goes away. I'm assuming this is occurring because the SkyModalHostComponent is not created during the app's initial bootstrap phase.

Plunker

https://plnkr.co/edit/i9nopmeYvhL2dH1KRq68?p=preview

@Blackbaud-PatrickOFriel
Copy link
Contributor

In 2.0.0-beta.30

@maximelafarie
Copy link

Same error here.

import {ApplicationRef, Injectable} from '@angular/core';

@Injectable()
export class LoaderService {

  loading: boolean = false;

  constructor(private applicationRef: ApplicationRef) {
  }

  start() {
    this.loading = true;
    this.applicationRef.tick();
  }

  stop() {
    this.loading = false;
    this.applicationRef.tick();
  }

  getState(): boolean {
    return this.loading;
  }

}

@Santoshah
Copy link

getting same error

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants