@angular/core#ChangeDetectorRef TypeScript Examples

The following examples show how to use @angular/core#ChangeDetectorRef. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: side-bar.component.ts    From Smersh with MIT License 6 votes vote down vote up
constructor(
    changeDetectorRef: ChangeDetectorRef,
    media: MediaMatcher,
    private connection: ConnectionService,
    public themeService: ThemeService,
    public localeService: LocaleService,
    private translate: TranslateService
  ) {
    this.mobileQuery = media.matchMedia('(max-width: 600px)');
    this._mobileQueryListener = () => changeDetectorRef.detectChanges();
    this.mobileQuery.addListener(this._mobileQueryListener);

    Object.entries({
      Mission: MissionRouter.redirectToList(),
      Vuln: VulnRouter.redirectToList(),
      Host: HostRouter.redirectToList(),
      User: UserRouter.redirectToList(),
      Impact: ImpactRouter.redirectToList(),
      Client: ClientRouter.redirectToList(),
    })
      .filter(([k]) => isGranted(`ROLE_${k.toUpperCase()}_GET_LIST`))
      .map(([k, v]) => (this.fillerNav[`${k}s`] = v));
  }
Example #2
Source File: typer.component.ts    From TypeFast with MIT License 6 votes vote down vote up
constructor(
    private wordService: WordService,
    private cdRef: ChangeDetectorRef,
    private preferencesService: PreferencesService
  ) {
    this.wordService.addWordListListener(this.onUpdatedWordList.bind(this));

    this.preferences = preferencesService.getPreferences();

    this.testTime = this.preferences.get(
      Preference.DEFAULT_TEST_DURATION
    ).value;
    this.smoothScroll = this.preferences.get(Preference.SMOOTH_SCROLLING).value;
    this.ignoreAccentedCharacters = this.preferences.get(
      Preference.IGNORE_DIACRITICS
    ).value;
    this.ignoreCasing = this.preferences.get(Preference.IGNORE_CASING).value;
    this.wordMode = this.preferences.get(Preference.WORD_MODE).value;

    this.updateIgnoreResultString();
  }
Example #3
Source File: deposit-liquidity.component.ts    From xBull-Wallet with GNU Affero General Public License v3.0 6 votes vote down vote up
constructor(
    private readonly liquidityPoolsService: LiquidityPoolsService,
    private readonly lpAssetsQuery: LpAssetsQuery,
    private readonly lpAssetsStore: LpAssetsStore,
    private readonly cdr: ChangeDetectorRef,
    private readonly horizonApisQuery: HorizonApisQuery,
    private readonly nzMessageService: NzMessageService,
    private readonly walletAssetsQuery: WalletsAssetsQuery,
    private readonly walletsAssetsService: WalletsAssetsService,
    private readonly stellarSdkService: StellarSdkService,
    private readonly walletsAccountsQuery: WalletsAccountsQuery,
    private readonly nzDrawerService: NzDrawerService,
    private readonly walletsAccountsService: WalletsAccountsService,
    private readonly translateService: TranslateService,
  ) { }
Example #4
Source File: rubic-menu.component.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    private authService: AuthService,
    private readonly cdr: ChangeDetectorRef,
    private readonly walletConnectorService: WalletConnectorService,
    private readonly counterNotificationsService: CounterNotificationsService,
    private readonly gtmService: GoogleTagManagerService,
    @Inject(WINDOW) private window: Window
  ) {
    this.currentUser$ = this.authService.getCurrentUser();
    this.countUnread$ = this.counterNotificationsService.unread$;
    this.navigationList = NAVIGATION_LIST;
    this.bridgeClick = new EventEmitter<void>();
    this.swapClick = new EventEmitter<void>();
    this.crossChainClick = new EventEmitter<void>();
  }
Example #5
Source File: downloads-modal.component.ts    From Bridge with GNU General Public License v3.0 6 votes vote down vote up
constructor(private electronService: ElectronService, private downloadService: DownloadService, ref: ChangeDetectorRef) {
    electronService.receiveIPC('queue-updated', (order) => {
      this.downloads.sort((a, b) => order.indexOf(a.versionID) - order.indexOf(b.versionID))
    })

    downloadService.onDownloadUpdated(download => {
      const index = this.downloads.findIndex(thisDownload => thisDownload.versionID == download.versionID)
      if (download.type == 'cancel') {
        this.downloads = this.downloads.filter(thisDownload => thisDownload.versionID != download.versionID)
      } else if (index == -1) {
        this.downloads.push(download)
      } else {
        this.downloads[index] = download
      }
      ref.detectChanges()
    })
  }
Example #6
Source File: accordion-item.component.ts    From canopy with Apache License 2.0 6 votes vote down vote up
constructor(
    @Optional() @SkipSelf() @Inject(LG_ACCORDION) public accordion: LgAccordionComponent,
    private selectionDispatcher: UniqueSelectionDispatcher,
    private cdr: ChangeDetectorRef,
  ) {
    this._removeSingleItemSelectionListener = selectionDispatcher.listen(
      (id: string, accordionId: string) => {
        if (
          accordion &&
          !accordion.multi &&
          accordion.id === accordionId &&
          this._id !== id
        ) {
          this.isActive = false;
          this.accordionPanelHeading.isActive = false;

          this.closed.emit();
          this.cdr.markForCheck();
        }
      },
    );
  }
Example #7
Source File: sessions.component.ts    From leapp with Mozilla Public License 2.0 6 votes vote down vote up
constructor(
    private ref: ChangeDetectorRef,
    private router: Router,
    private route: ActivatedRoute,
    private httpClient: HttpClient,
    private modalService: BsModalService,
    private appService: AppService,
    private leappCoreService: AppProviderService
  ) {
    this.behaviouralSubjectService = this.leappCoreService.behaviouralSubjectService;
    this.awsCoreService = this.leappCoreService.awsCoreService;

    this.columnSettings = Array.from(Array(5)).map((): ArrowSettings => ({ activeArrow: false, orderStyle: false }));
    const subscription = globalHasFilter.subscribe((value) => {
      this.eGlobalFilterExtended = value;
    });
    const subscription2 = globalFilteredSessions.subscribe((value) => {
      this.eGlobalFilteredSessions = value;
    });
    const subscription3 = compactMode.subscribe((value) => {
      this.eCompactMode = value;
    });
    const subscription4 = globalFilterGroup.subscribe((value) => {
      this.eGlobalFilterGroup = value;
    });
    const subscription5 = globalColumns.subscribe((value) => {
      this.eGlobalColumns = value;
    });

    this.subscriptions.push(subscription);
    this.subscriptions.push(subscription2);
    this.subscriptions.push(subscription3);
    this.subscriptions.push(subscription4);
    this.subscriptions.push(subscription5);

    globalOrderingFilter.next(JSON.parse(JSON.stringify(this.behaviouralSubjectService.sessions)));
  }
Example #8
Source File: consume.component.ts    From pantry_party with Apache License 2.0 6 votes vote down vote up
constructor(
    private changeRef: ChangeDetectorRef,
    public scannedItemManager: ScannedItemManagerService,
    public grocyService: GrocyService
  ) {

    scannedItemManager.undoCallback = i => this.grocyService.undoBooking(i);

    scannedItemManager.saveCallback = i => {
      const consumeProductProps: ConsumeProductsParams = {
        productId: i.grocyProduct.id,
        quantity: i.quantity,
        spoiled: false,
        locationId: i.location ? i.location.id : undefined
      };

      return this.grocyService.addBarcodeToProduct(
        i.grocyProduct.id,
        i.barcode
      ).pipe(
        switchMap(
          () => this.grocyService.consumeProduct(consumeProductProps)
        ),
        map(r => r.id)
      );
    };
  }
Example #9
Source File: channel-favorites.component.ts    From qd-messages-ts with GNU Affero General Public License v3.0 6 votes vote down vote up
constructor(private cd: ChangeDetectorRef, private database: ChannelFavoritesDatabase,private ui: UiService,private dialog:NbDialogService,private nbMenuService: NbMenuService, private q: QuestOSService) {

    this.itemClickSub = this.nbMenuService.onItemClick().subscribe( (menuItem) => {

        // if(String(menuItem.item.title) == 'Add Favorite'){
        //     this.getFavoriteFolderList();
        //     this.open(this.importPop);
        // }
       if(String(menuItem.item.title) == 'New Favorite Folder'){
            this.getFavoriteFolderList();
            this.open(this.newFavoriteFolderPop);
        }
    });



    this.database.setQOS(this.q);

    this.treeFlattener = new MatTreeFlattener(this.transformer, this.getLevel, this.isExpandable, this.getChildren);
    this.treeControl = new FlatTreeControl<TodoItemFlatNode>(this.getLevel, this.isExpandable);
    this.dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener);


    }
Example #10
Source File: app-details.component.ts    From scion-microfrontend-platform with Eclipse Public License 2.0 6 votes vote down vote up
constructor(private _shellService: ShellService,
              private _route: ActivatedRoute,
              private _router: Router,
              private _manifestService: DevToolsManifestService,
              private _cd: ChangeDetectorRef) {
    this.application$ = this.observeApplication$();
    this.capabilities$ = this.observeCapabilities$();
    this.intentions$ = this.observeIntentions$();

    this.installTitleProvider();
    this.installTabActivator();
  }
Example #11
Source File: emote.component.ts    From App with MIT License 6 votes vote down vote up
constructor(
		@Inject(DOCUMENT) private document: Document,
		private metaService: Meta,
		private restService: RestService,
		private route: ActivatedRoute,
		private router: Router,
		private cdr: ChangeDetectorRef,
		private dialog: MatDialog,
		private appService: AppService,
		private emoteListService: EmoteListService,
		private dataService: DataService,
		public themingService: ThemingService,
		public clientService: ClientService
	) { }
Example #12
Source File: alert-list.component.ts    From VIR with MIT License 6 votes vote down vote up
constructor(
    private readonly changeDetectorRef: ChangeDetectorRef,
    private readonly dataStore: DataStore,
    private readonly dataAnalyzer: DataAnalyzer,
    private readonly dialog: MatDialog,
    private readonly zone: NgZone,
    private readonly home: HomeComponent,
  ) {
    this.alertActionCtx = {
      showItemInItems: (itemID: ItemID) => {
        this.home.showInItems(itemID)
      },
      showItemInQueue: (itemID: ItemID) => {
        this.home.showInQueue(itemID)
      },
      editItem: (itemID: ItemID) => {
        const item = this.dataStore.getItem(itemID)
        if (item === undefined) return
        const dialogRef = this.dialog.open(ItemDetailsComponent, {
          width: ItemDetailsComponent.DIALOG_WIDTH,
          data: {item},
          hasBackdrop: true,
          disableClose: false,
          autoFocus: false,
        })
      },
      dataStore: this.dataStore,
    }
  }
Example #13
Source File: addon-detail.component.ts    From WowUp with GNU General Public License v3.0 6 votes vote down vote up
public constructor(
    @Inject(MAT_DIALOG_DATA) public model: AddonDetailModel,
    private _dialogRef: MatDialogRef<AddonDetailComponent>,
    private _addonService: AddonService,
    private _addonProviderService: AddonProviderFactory,
    private _cdRef: ChangeDetectorRef,
    private _snackbarService: SnackbarService,
    private _translateService: TranslateService,
    private _sessionService: SessionService,
    private _linkService: LinkService,
    private _addonUiService: AddonUiService,
    private _wowupService: WowUpService,
    public gallery: Gallery
  ) {
    this._dependencies = this.getDependencies();

    this._addonService.addonInstalled$
      .pipe(takeUntil(this._destroy$), filter(this.isSameAddon))
      .subscribe(this.onAddonInstalledUpdate);

    from(this.getChangelog())
      .pipe(
        takeUntil(this._destroy$),
        tap(() => (this.fetchingChangelog = false))
      )
      .subscribe((changelog) => {
        this.hasChangeLog = !!changelog;
        this._changelogSrc.next(changelog);
      });

    from(this.getFullDescription())
      .pipe(
        takeUntil(this._destroy$),
        tap(() => (this.fetchingFullDescription = false))
      )
      .subscribe((description) => this._descriptionSrc.next(description));
  }
Example #14
Source File: anchor.component.ts    From alauda-ui with MIT License 6 votes vote down vote up
watchLabelsChange() {
    this.depose$$.next();
    const cdr = this.injector.get(ChangeDetectorRef);
    // FIXME: Is there any better way to achieve this?
    combineLatest(
      this.treeItems.map(({ labelChange }) => labelChange).filter(Boolean),
    )
      .pipe(debounceTime(0), takeUntil(this.depose$$))
      .subscribe(() => cdr.markForCheck());
  }
Example #15
Source File: image-crop.component.ts    From ASW-Form-Builder with MIT License 6 votes vote down vote up
constructor(
        private cropService: CropService,
        private cropperPositionService: CropperPositionService,
        private loadImageService: LoadImageService,
        private sanitizer: DomSanitizer,
        private cd: ChangeDetectorRef
    ) {
        this.reset();
    }
Example #16
Source File: login.component.ts    From blockcore-hub with MIT License 6 votes vote down vote up
constructor(
        private http: HttpClient,
        private readonly cd: ChangeDetectorRef,
        private authService: AuthenticationService,
        private walletService: WalletService,
        private router: Router,
        private globalService: GlobalService,
        private wallet: WalletService,
        private storageService: StorageService,
        private electronService: ElectronService,
        private chains: ChainService,
        private log: Logger,
        private apiService: ApiService,
        public appState: ApplicationStateService) {

        if (electronService.ipcRenderer) {
            this.ipc = electronService.ipcRenderer;
        }

    }
Example #17
Source File: drawer-nav-item.component.ts    From angular-component-library with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
constructor(drawerService: DrawerService, public changeDetectorRef: ChangeDetectorRef) {
        super(drawerService, changeDetectorRef);
        this.id = drawerService.createNavItemID();
        this.drawerService.emitNewNavItemCreated();
        this.drawerService.drawerOpenChanges().subscribe(() => {
            this.handleExpand();
        });
        this.drawerService.drawerActiveItemChanges().subscribe(() => {
            if (this.navItemEl) {
                this.manageActiveItemTreeHighlight();
            }
        });
    }
Example #18
Source File: anti-spam-claimable-assets.component.ts    From xBull-Wallet with GNU Affero General Public License v3.0 5 votes vote down vote up
constructor(
    private readonly settingsQuery: SettingsQuery,
    private readonly settingsService: SettingsService,
    private readonly nzMessageService: NzMessageService,
    private readonly cdr: ChangeDetectorRef,
    private readonly translateService: TranslateService,
  ) { }
Example #19
Source File: unknown-error.component.ts    From rubic-app with GNU General Public License v3.0 5 votes vote down vote up
constructor(
    @Inject(POLYMORPHEUS_CONTEXT)
    private readonly context: TuiDialogContext<void, RubicError<ERROR_TYPE>>,
    private readonly cdr: ChangeDetectorRef,
    @Inject(NAVIGATOR) private readonly navigator: Navigator
  ) {
    this.error = context.data;
  }
Example #20
Source File: basic-list.component.ts    From ng-devui-admin with MIT License 5 votes vote down vote up
constructor(private listDataService: ListDataService, private dialogService: DialogService, private cdr: ChangeDetectorRef) {}