@angular/forms#FormGroup TypeScript Examples

The following examples show how to use @angular/forms#FormGroup. 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: home.component.ts    From one-platform with MIT License 6 votes vote down vote up
// upload form management
  auditUploadForm = new FormGroup({
    project: new FormControl('', [
      Validators.required,
      this.whitespaceValidator,
    ]),
    branch: new FormControl('', [
      Validators.required,
      this.whitespaceValidator,
    ]),
    buildToken: new FormControl('', [
      Validators.required,
      this.whitespaceValidator,
    ]),
  });
Example #2
Source File: login.component.ts    From homebridge-nest-cam with GNU General Public License v3.0 6 votes vote down vote up
generateForm(): void {
    this.form = new FormGroup({
      code: new FormControl('', [Validators.required, containsValidator('/')]),
    });

    // this.form.valueChanges.subscribe((value) => {
    //   // Do something here
    // });
  }
Example #3
Source File: confirm-trezor-keys.component.ts    From xBull-Wallet with GNU Affero General Public License v3.0 6 votes vote down vote up
async requestAccounts(): Promise<void> {
    const amountOfAccountsLoaded = this.accounts.length;
    let response: Unsuccessful | Success<StellarAddress[]>;
    try {
      response = await this.hardwareWalletsService.getTrezorPublicKeys({
        start: amountOfAccountsLoaded,
        end: amountOfAccountsLoaded + 4,
      });
    } catch (e: any) {
      console.error(e);
      this.nzMessageService.error(`There was an error we didn't expect, try again or contact support`, {
        nzDuration: 5000
      });
      return;
    }

    if (!response.success) {
      this.nzMessageService.error(`We can't continue`, {
        nzDuration: 5000,
      });
      return;
    }

    response.payload.forEach(record => {
      this.accounts.push(new FormGroup({
        publicKey: new FormControl(record.address),
        path: new FormControl(record.serializedPath),
        active: new FormControl(true),
      }));
    });
  }
Example #4
Source File: command-bar.component.ts    From leapp with Mozilla Public License 2.0 6 votes vote down vote up
filterForm = new FormGroup({
    searchFilter: new FormControl(""),
    dateFilter: new FormControl(true),
    providerFilter: new FormControl([]),
    profileFilter: new FormControl([]),
    regionFilter: new FormControl([]),
    integrationFilter: new FormControl([]),
    typeFilter: new FormControl([]),
  });
Example #5
Source File: home.component.ts    From Angular-Cookbook with MIT License 6 votes vote down vote up
ngOnInit() {
    this.componentAlive = true;
    this.searchForm = new FormGroup({
      username: new FormControl('', []),
    });
    this.searchUsers();
    this.searchForm
      .get('username')
      .valueChanges.pipe(
        takeWhile(() => !!this.componentAlive),
        debounceTime(300)
      )
      .subscribe(() => {
        this.searchUsers();
      });
  }
Example #6
Source File: router-outlet-context.component.ts    From scion-microfrontend-platform with Eclipse Public License 2.0 6 votes vote down vote up
constructor(host: ElementRef<HTMLElement>,
              formBuilder: FormBuilder,
              public routerOutlet: SciRouterOutletElement,
              private _overlay: OverlayRef) {
    this.form = new FormGroup({
      [NAME]: formBuilder.control('', Validators.required),
      [VALUE]: formBuilder.control(''),
    }, {updateOn: 'change'});

    this._overlay.backdropClick()
      .pipe(takeUntil(this._destroy$))
      .subscribe(() => {
        this._overlay.dispose();
      });
  }
Example #7
Source File: emote-form.service.ts    From App with MIT License 6 votes vote down vote up
form = new FormGroup({
		name: new FormControl('', [
			Validators.pattern(Constants.Emotes.NAME_REGEXP)
		]),
		tags: new FormControl([]),
		is_private: new FormControl(false),
		is_zerowidth: new FormControl(false),
		emote: new FormControl('')
	});
Example #8
Source File: login-form-ui.component.ts    From svvs with MIT License 6 votes vote down vote up
ngOnInit(): void {
    this.loginForm = new FormGroup({
      login: new FormControl('', [
        Validators.required
      ]),
      password: new FormControl('', [
        Validators.required
      ])
    })
  }
Example #9
Source File: create-position.component.ts    From 1x.ag with MIT License 5 votes vote down vote up
formGroup = new FormGroup({});
Example #10
Source File: app.component.ts    From gnosis.1inch.exchange with MIT License 5 votes vote down vote up
swapForm = new FormGroup({
        fromAmount: new FormControl('', this.tokenAmountInputValidator),
        toAmount: new FormControl('', [...this.tokenAmountInputValidator]),
    });
Example #11
Source File: login.component.ts    From homebridge-nest-cam with GNU General Public License v3.0 5 votes vote down vote up
public form?: FormGroup;
Example #12
Source File: generic-form.component.ts    From Smersh with MIT License 5 votes vote down vote up
public period = new FormGroup({
    start: new FormControl(),
    stop: new FormControl(),
  });
Example #13
Source File: confirm-public-keys.component.ts    From xBull-Wallet with GNU Affero General Public License v3.0 5 votes vote down vote up
async getAccounts(): Promise<void> {
    this.loading$.next(true);
    const newAccounts = [];
    let firstAccount: string | null = null;

    try {
      let index = this.accounts.controls.length;
      const lastIndex = index + 4;

      while (index < lastIndex) {
        const path = `44'/148'/${index}'`;
        const key = await this.hardwareWalletsService.getLedgerPublicKey(path, this.transport);

        if (!firstAccount) {
          firstAccount = key;
        }

        this.accounts.push(new FormGroup({
          publicKey: new FormControl(key),
          path: new FormControl(path),
          active: new FormControl(true),
        }));

        newAccounts.push({ key, path, active: false });
        index++;
      }

      if (newAccounts.every(account => account.key === firstAccount)) {
        this.nzMessageService.error(`We can't get the accounts from your wallet, please make sure your wallet is unlocked and with the Stellar App opened`, {
          nzDuration: 5000,
        });
        await this.onClose();
        return;
      }

      this.loading$.next(false);
    } catch (e: any) {
      console.log(e);
      this.loading$.next(false);
    }
  }
Example #14
Source File: datasource.component.ts    From dbm with Apache License 2.0 5 votes vote down vote up
validateForm!: FormGroup;
Example #15
Source File: login.component.ts    From ng-conf-2020-workshop with MIT License 5 votes vote down vote up
public loginForm: FormGroup;
Example #16
Source File: app.component.ts    From ngx-colors with MIT License 5 votes vote down vote up
testForm = new FormGroup({
    testCtrl: new FormControl(""),
  });
Example #17
Source File: add-blog.component.ts    From Collab-Blog with GNU General Public License v3.0 5 votes vote down vote up
blogForm:FormGroup;
Example #18
Source File: card.stories.ts    From canopy with Apache License 2.0 5 votes vote down vote up
form: FormGroup;
Example #19
Source File: user-list.component.ts    From master-frontend-lemoncode with MIT License 5 votes vote down vote up
editForm: FormGroup;
Example #20
Source File: admin-product.component.ts    From mslearn-live-azure-fundamentals with MIT License 5 votes vote down vote up
productForm: FormGroup;
Example #21
Source File: popover.component.ts    From mylog14 with GNU General Public License v3.0 5 votes vote down vote up
form = new FormGroup({});
Example #22
Source File: directory.component.ts    From acnh.directory with MIT License 5 votes vote down vote up
langForm = new FormGroup({
    lang: new FormControl()
  });
Example #23
Source File: column-dialog.component.ts    From leapp with Mozilla Public License 2.0 5 votes vote down vote up
columnForm = new FormGroup({
    role: new FormControl(),
    provider: new FormControl(),
    namedProfile: new FormControl(),
    region: new FormControl(),
  });
Example #24
Source File: license-details.component.ts    From barista with Apache License 2.0 5 votes vote down vote up
form = new FormGroup({});