@angular/core#Self TypeScript Examples

The following examples show how to use @angular/core#Self. 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: bridge-swap-info.component.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    private readonly cdr: ChangeDetectorRef,
    private readonly swapInfoService: SwapInfoService,
    private readonly swapFormService: SwapFormService,
    private readonly bridgeService: BridgeService,
    @Self() private readonly destroy$: TuiDestroyService
  ) {
    this.averageTimeInProvider = {
      [BRIDGE_PROVIDER.SWAP_RBC]: '5m',
      [BRIDGE_PROVIDER.POLYGON]: '30m'
    };
  }
Example #2
Source File: radio-button.component.ts    From canopy with Apache License 2.0 6 votes vote down vote up
constructor(
    @Self() @Optional() public control: NgControl,
    @Inject(forwardRef(() => LgRadioGroupComponent))
    private radioGroup: LgRadioGroupComponent,
    private errorState: LgErrorStateMatcher,
    @Optional()
    @Host()
    @SkipSelf()
    private controlContainer: FormGroupDirective,
    private renderer: Renderer2,
    private hostElement: ElementRef,
    private domService: LgDomService,
  ) {}
Example #3
Source File: radio-group.component.ts    From canopy with Apache License 2.0 6 votes vote down vote up
constructor(
    @Self() @Optional() private control: NgControl,
    private errorState: LgErrorStateMatcher,
    @Optional()
    @Host()
    @SkipSelf()
    private controlContainer: FormGroupDirective,
    private domService: LgDomService,
    private hostElement: ElementRef,
    private renderer: Renderer2,
  ) {
    this.variant = this.hostElement.nativeElement.tagName
      .split('-')[1]
      .toLowerCase() as RadioVariant;

    if (this.control != null) {
      this.control.valueAccessor = this;
    }
  }
Example #4
Source File: checkbox-group.component.ts    From canopy with Apache License 2.0 6 votes vote down vote up
constructor(
    @Self() @Optional() private control: NgControl,
    private errorState: LgErrorStateMatcher,
    @Optional()
    @Host()
    @SkipSelf()
    private controlContainer: FormGroupDirective,
    private domService: LgDomService,
    private renderer: Renderer2,
    private hostElement: ElementRef,
  ) {
    this.variant = this.hostElement.nativeElement.tagName
      .split('-')[1]
      .toLowerCase() as CheckboxGroupVariant;

    if (this.control != null) {
      this.control.valueAccessor = this;
    }
  }
Example #5
Source File: tokens-select.component.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    @Inject(POLYMORPHEUS_CONTEXT) private readonly context: ComponentContext,
    private readonly cdr: ChangeDetectorRef,
    private readonly publicBlockchainAdapterService: PublicBlockchainAdapterService,
    private readonly httpClient: HttpClient,
    private readonly tokensService: TokensService,
    @Self() private readonly destroy$: TuiDestroyService,
    @Inject(DOCUMENT) private readonly document: Document
  ) {
    this.searchQueryLoading = false;
    this.listType = 'default';
    this.tokensListUpdating = false;
    this.initiateContextParams(context.data);
  }
Example #6
Source File: tokens-list.component.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    private readonly cdr: ChangeDetectorRef,
    private readonly queryParamsService: QueryParamsService,
    @Self() private readonly destroy$: TuiDestroyService,
    private readonly iframeService: IframeService,
    private readonly authService: AuthService,
    private readonly walletsModalService: WalletsModalService,
    @Inject(WINDOW) private readonly window: RubicWindow
  ) {
    this.loading = false;
    this.pageUpdate = new EventEmitter();
    this.scrollSubject$ = new BehaviorSubject(undefined);
  }
Example #7
Source File: toggle.component.ts    From canopy with Apache License 2.0 6 votes vote down vote up
constructor(
    @Self() @Optional() public control: NgControl,
    @Optional()
    @Inject(forwardRef(() => LgCheckboxGroupComponent))
    private checkboxGroup: LgCheckboxGroupComponent,
    private domService: LgDomService,
    private errorState: LgErrorStateMatcher,
    @Optional()
    @Host()
    @SkipSelf()
    private controlContainer: FormGroupDirective,
    private hostElement: ElementRef,
  ) {
    this.selectorVariant = this.hostElement.nativeElement.tagName
      .split('-')[1]
      .toLowerCase();

    if (this.checkboxGroup) {
      return;
    }

    if (this.control != null) {
      this.control.valueAccessor = this;
    }
  }
Example #8
Source File: dxc-select.component.ts    From halstack-angular with Apache License 2.0 6 votes vote down vote up
constructor(
    private helper: DxcSelectHelper,
    @Self() public service: SelectService,
    private ref: ElementRef
  ) {
    this.service.selectedValues?.subscribe((selectedValues) => {
      if (selectedValues) {
        this.formValues = this.multiple
          ? selectedValues.map((item) => item.value).toString()
          : selectedValues.value;
      }
    });
  }
Example #9
Source File: dxc-slider.component.ts    From halstack-angular with Apache License 2.0 6 votes vote down vote up
constructor(
    @Self() private utils: CssUtils,
    @Optional() public bgProviderService?: BackgroundProviderService
  ) {
    this.bgProviderService.$changeColor.subscribe((value) => {
      if (value === "dark") {
        this.darkBackground = true;
      } else if (value === "light") {
        this.darkBackground = false;
      }
    });
  }
Example #10
Source File: instant-trade-swap-info.component.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    private readonly cdr: ChangeDetectorRef,
    private readonly swapInfoService: SwapInfoService,
    private readonly swapFormService: SwapFormService,
    private readonly settingsService: SettingsService,
    private readonly priceImpactService: PriceImpactService,
    private readonly bigNumberFormatPipe: BigNumberFormatPipe,
    private readonly withRoundPipe: WithRoundPipe,
    @Self() private readonly destroy$: TuiDestroyService
  ) {
    this.rateType = 'fromTokenRate';
  }
Example #11
Source File: cross-chain-bridge-swap-info.component.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    private readonly cdr: ChangeDetectorRef,
    private readonly swapFormService: SwapFormService,
    private readonly authService: AuthService,
    private readonly settingsService: SettingsService,
    @Self() private readonly destroy$: TuiDestroyService,
    private readonly targetNetworkAddressService: TargetNetworkAddressService
  ) {
    this.isWalletCopied = false;
  }
Example #12
Source File: cross-chain-swap-info.component.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    private readonly cdr: ChangeDetectorRef,
    private readonly swapInfoService: SwapInfoService,
    private readonly swapFormService: SwapFormService,
    private readonly crossChainRoutingService: CrossChainRoutingService,
    private readonly settingsService: SettingsService,
    private readonly tokensService: TokensService,
    private readonly priceImpactService: PriceImpactService,
    private readonly publicBlockchainAdapterService: PublicBlockchainAdapterService,
    @Self() private readonly destroy$: TuiDestroyService
  ) {}
Example #13
Source File: event-form.component.ts    From forms-typed with MIT License 6 votes vote down vote up
constructor(@Optional() @Self() directive: NgControl) {
    super(
      directive,
      typedFormGroup({
        eventName: typedFormControl<string>(undefined, Validators.required),
        location: typedFormControl<string>(),
        dateStart: typedFormControl(defaultDateStart),
        timeStart: typedFormControl(defaultTimeStart)
      })
    );
  }
Example #14
Source File: instant-trade-bottom-form.component.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    private readonly cdr: ChangeDetectorRef,
    public readonly swapFormService: SwapFormService,
    private readonly instantTradeService: InstantTradeService,
    private readonly errorService: ErrorsService,
    private readonly authService: AuthService,
    private readonly tokensService: TokensService,
    private readonly settingsService: SettingsService,
    private readonly iframeService: IframeService,
    private readonly swapInfoService: SwapInfoService,
    private readonly gtmService: GoogleTagManagerService,
    private readonly publicBlockchainAdapterService: PublicBlockchainAdapterService,
    @Self() private readonly destroy$: TuiDestroyService
  ) {
    this.isIframe = this.iframeService.isIframe;
  }
Example #15
Source File: cross-chain-routing-bottom-form.component.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    private readonly cdr: ChangeDetectorRef,
    public readonly swapFormService: SwapFormService,
    private readonly errorsService: ErrorsService,
    private readonly settingsService: SettingsService,
    private readonly authService: AuthService,
    private readonly tokensService: TokensService,
    private readonly crossChainRoutingService: CrossChainRoutingService,
    private readonly counterNotificationsService: CounterNotificationsService,
    private readonly gtmService: GoogleTagManagerService,
    private readonly targetNetworkAddressService: TargetNetworkAddressService,
    @Self() private readonly destroy$: TuiDestroyService
  ) {}
Example #16
Source File: person-contact.component.ts    From forms-typed with MIT License 6 votes vote down vote up
constructor(@Self() @Optional() controlDirective: NgControl) {
    super(
      controlDirective,
      typedFormGroup<PersonContact>({
        name: typedFormControl<string>(),
        email: typedFormControl<string>()
      })
    );
  }
Example #17
Source File: file-input.component.ts    From angular-material-components with MIT License 6 votes vote down vote up
constructor(protected _elementRef: ElementRef<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>,
    protected _platform: Platform,
    private _cd: ChangeDetectorRef,
    @Optional() @Self() public ngControl: NgControl,
    @Optional() _parentForm: NgForm,
    @Optional() _parentFormGroup: FormGroupDirective,
    _defaultErrorStateMatcher: ErrorStateMatcher) {
    super(_defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl);

    this.id = this.id;

    if (this.ngControl) {
      this.ngControl.valueAccessor = this;
    }

  }
Example #18
Source File: staking-container.component.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    private readonly router: Router,
    private readonly stakingService: StakingService,
    private readonly walletConnectorService: WalletConnectorService,
    private readonly authService: AuthService,
    private readonly swapFormService: SwapFormService,
    private readonly tokensService: TokensService,
    @Self() private readonly destroy$: TuiDestroyService,
    @Inject(WINDOW) private readonly window: RubicWindow
  ) {}
Example #19
Source File: panel-chart.component.ts    From EDA with GNU Affero General Public License v3.0 6 votes vote down vote up
constructor(public resolver: ComponentFactoryResolver,
        private chartUtils: ChartUtilsService,
        @Self() private ownRef: ElementRef,
        private zone: NgZone,
        private styleProviderService: StyleProviderService) {

        this.styleProviderService.panelFontColor.subscribe(color => {
            this.fontColor = color;
            if(this.props && ['doughnut', 'polarArea', 'bar', 'horizontalBar', 'line', 'area', 'barline', 'histogram'].includes(this.props.chartType)) this.ngOnChanges(null);
        });

        this.styleProviderService.panelFontFamily.subscribe(family => {
            this.fontFamily = family;
            if(this.props && ['doughnut', 'polarArea', 'bar', 'horizontalBar', 'line', 'area', 'barline', 'histogram'].includes(this.props.chartType)) this.ngOnChanges(null);
        });

        this.styleProviderService.panelFontSize.subscribe(size => {
            this.fontSize = size;
            if(this.props && ['doughnut', 'polarArea', 'bar', 'horizontalBar', 'line','area', 'barline', 'histogram'].includes(this.props.chartType)) this.ngOnChanges(null);
        });
    }
Example #20
Source File: promotion-stats.component.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    @Self() private readonly destroy$: TuiDestroyService,
    private readonly authService: AuthService,
    private readonly walletsModalService: WalletsModalService,
    private readonly promotionService: PromotionService,
    private readonly walletConnectorService: WalletConnectorService,
    private readonly errorsService: ErrorsService
  ) {
    this.isWalletConnected$ = authService.getCurrentUser().pipe(map(user => !!user?.address));
    this.isEthLikeWalletConnected$ = authService
      .getCurrentUser()
      .pipe(
        map(
          user => !!user?.address && this.walletConnectorService.provider.walletType === 'ethLike'
        )
      );

    this.statistics$ = promotionService.statistics$;
    this.isStatisticsLoading$ = promotionService.isStatisticsLoading$;
    this.promoLink$ = promotionService.promoLink$;
    this.isPromoLinkLoading$ = promotionService.isPromoLinkLoading$;
  }
Example #21
Source File: my-trades.component.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    private readonly cdr: ChangeDetectorRef,
    private readonly myTradesService: MyTradesService,
    private readonly authService: AuthService,
    private readonly errorsService: ErrorsService,
    private readonly walletsModalService: WalletsModalService,
    private readonly counterNotificationsService: CounterNotificationsService,
    @Self() private readonly destroy$: TuiDestroyService,
    @Inject(WINDOW) private readonly window: Window,
    private readonly notificationsService: NotificationsService,
    private readonly translateService: TranslateService,
    private readonly symbiosisService: SymbiosisService
  ) {}
Example #22
Source File: pagination.directive.ts    From angular-custom-material-paginator with MIT License 6 votes vote down vote up
constructor(
    @Host() @Self() @Optional() private readonly matPag: MatPaginator,
    private readonly ViewContainer: ViewContainerRef,
    private readonly renderer: Renderer2
  ) {
    this.currentPage = 1;
    this.pageGapTxt = ['•••', '---'];
    this.showTotalPages = 3;
    this.checkPage = [0, 0, 0];
    // Display custom range label text
    this.matPag._intl.getRangeLabel = (page: number, pageSize: number, length: number): string => {
      const startIndex = page * pageSize;
      const endIndex = startIndex < length ?
        Math.min(startIndex + pageSize, length) :
        startIndex + pageSize;
      return length > 0 ? 'Showing ' + (startIndex + 1) + ' – ' + endIndex + ' of ' + length + ' records' : 'Showing 0 – 0 of 0 records';
    };
    // Subscribe to rerender buttons when next page and last page button is used
    this.matPag.page.subscribe((paginator: PageEvent) => {
      this.currentPage = paginator.pageIndex;
      this.matPag.pageIndex = paginator.pageIndex;
      this.initPageRange();
    });
  }
Example #23
Source File: header.component.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    @Inject(PLATFORM_ID) platformId: Object,
    private readonly headerStore: HeaderStore,
    private readonly authService: AuthService,
    private readonly iframeService: IframeService,
    private readonly cdr: ChangeDetectorRef,
    private readonly storeService: StoreService,
    private readonly router: Router,
    private readonly errorService: ErrorsService,
    private readonly queryParamsService: QueryParamsService,
    private readonly swapFormService: SwapFormService,
    private readonly swapsService: SwapsService,
    private readonly myTradesService: MyTradesService,
    private readonly tokensService: TokensService,
    @Inject(WINDOW) private readonly window: Window,
    @Inject(DOCUMENT) private readonly document: Document,
    @Self() private readonly destroy$: TuiDestroyService,
    private readonly gtmService: GoogleTagManagerService,
    private readonly zone: NgZone
  ) {
    this.loadUser();
    this.advertisementType = 'default';
    this.currentUser$ = this.authService.getCurrentUser();
    this.isMobileMenuOpened$ = this.headerStore.getMobileMenuOpeningStatus();
    this.isMobile$ = this.headerStore.getMobileDisplayStatus();
    this.headerStore.setMobileDisplayStatus(this.window.innerWidth <= this.headerStore.mobileWidth);
    if (isPlatformBrowser(platformId)) {
      this.zone.runOutsideAngular(() => {
        this.setNotificationPosition();
        this.window.onscroll = () => {
          this.setNotificationPosition();
        };
      });
    }
    this.swapType$ = this.swapsService.swapMode$;
  }
Example #24
Source File: user-profile.component.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    private readonly headerStore: HeaderStore,
    private readonly router: Router,
    private readonly cdr: ChangeDetectorRef,
    private readonly authService: AuthService,
    private readonly walletConnectorService: WalletConnectorService,
    private translateService: TranslateService,
    @Inject(TuiDialogService) private readonly dialogService: TuiDialogService,
    @Inject(Injector) private injector: Injector,
    @Inject(WINDOW) private readonly window: Window,
    @Self() private readonly destroy$: TuiDestroyService
  ) {
    this.isMobile$ = this.headerStore.getMobileDisplayStatus();
    this.isConfirmModalOpened$ = this.headerStore.getConfirmModalOpeningStatus();
    this.router.events.subscribe(event => {
      if (event instanceof NavigationStart) {
        this.headerStore.setMobileMenuOpeningStatus(false);
        this.headerStore.setConfirmModalOpeningStatus(false);
      }
    });
    this.currentUser$ = this.authService.getCurrentUser();
  }
Example #25
Source File: matx-side-nav-toggle.directive.ts    From matx-angular with MIT License 5 votes vote down vote up
constructor(
    private mediaObserver: MediaObserver,
    @Host() @Self() @Optional() public sideNav: MatSidenav
  ) { 
  }
Example #26
Source File: control-value-accessor-connector.ts    From forms-typed with MIT License 5 votes vote down vote up
constructor(@Optional() @Self() private directive: NgControl, form: TypedFormGroup<T, C>) {
    if (directive) {
      directive.valueAccessor = this;
    }
    this.form = form;
  }
Example #27
Source File: nas-model.directive.ts    From s-libs with MIT License 5 votes vote down vote up
constructor(
    @Self()
    @Inject(NG_VALUE_ACCESSOR)
    valueAccessors: ControlValueAccessor[],
  ) {
    this.#valueAccessor = valueAccessors[0];
  }
Example #28
Source File: select.directive.ts    From canopy with Apache License 2.0 5 votes vote down vote up
constructor(
    @Self() @Optional() public control: NgControl,
    private errorState: LgErrorStateMatcher,
    @Optional()
    @Host()
    @SkipSelf()
    public controlContainer: FormGroupDirective,
  ) {}
Example #29
Source File: input.directive.ts    From canopy with Apache License 2.0 5 votes vote down vote up
constructor(
    @Self() @Optional() public control: NgControl,
    private errorState: LgErrorStateMatcher,
    @Optional()
    @Host()
    @SkipSelf()
    private controlContainer: FormGroupDirective,
  ) {}