@angular/forms#FormBuilder TypeScript Examples

The following examples show how to use @angular/forms#FormBuilder. 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: mission-single.component.ts    From Smersh with MIT License 6 votes vote down vote up
constructor(
    private route: ActivatedRoute,
    private burp: ConfigService,
    private _snackBar: MatSnackBar,
    public dialog: MatDialog,
    private hostsService: HostsService,
    private stepsService: StepsService,
    private router: Router,
    private missionsService: MissionsService,
    private uploadServices: UploadsService,
    private fb: FormBuilder
  ) {
    this.missionId = this.router.url.split('/').pop();
  }
Example #2
Source File: background-image.component.ts    From xBull-Wallet with GNU Affero General Public License v3.0 6 votes vote down vote up
constructor(
    private readonly walletsAssetsService: WalletsAssetsService,
    private readonly walletsAccountsQuery: WalletsAccountsQuery,
    private readonly walletsAssetsQuery: WalletsAssetsQuery,
    private readonly settingsService: SettingsService,
    private readonly settingsQuery: SettingsQuery,
    private readonly fb: FormBuilder,
    private readonly cdr: ChangeDetectorRef
  ) { }
Example #3
Source File: datasource.component.ts    From dbm with Apache License 2.0 6 votes vote down vote up
constructor(private service: DatasourceService,
              private messageService: NzMessageService,
              private translateService: TranslateService,
              private nzModalService: NzModalService,
              private datasourceJob: DatasourceJob,
              private formBuilder: FormBuilder) {
    super();
    this.validateForm = this.formBuilder.group({
      alias: [null, [Validators.required]],
      protocol: [null, [Validators.required]],
      host: [null, [Validators.required]],
      port: [null, [Validators.required]],
      username: [null, []],
      password: [null, []],
      maxTotal: [null, []],
      sshHost: [null, []],
      sshPort: [null, []],
      sshUsername: [null, []],
      sshPassword: [null, []]
    });
    this.sourceTypes = new SourceTypeConfig().getConfig();
    this.handlerGetAll();
    this.handlerResetButton();
  }
Example #4
Source File: login.component.ts    From ng-conf-2020-workshop with MIT License 6 votes vote down vote up
constructor(
    public authService: ExternalAuthService, private authentication: AuthenticationService,
    private userService: UserService, private router: Router, fb: FormBuilder
  ) {
    this.loginForm = fb.group({
      email: ['', Validators.required],
      password: ['', Validators.required],
    });
  }
Example #5
Source File: date-field.component.spec.ts    From canopy with Apache License 2.0 6 votes vote down vote up
constructor(public fb: FormBuilder) {
    this.form = this.fb.group({
      dateOfBirth: [ '' ],
    });

    this.form.valueChanges.subscribe(val => {
      this.dateChange.emit(val);
    });
  }
Example #6
Source File: user-list.component.ts    From master-frontend-lemoncode with MIT License 6 votes vote down vote up
constructor(private membersService: MembersService, private fb: FormBuilder) {
    this.membersService.getAll().then(
      members => this.members = members
    );

    this.newMember = {
      id: '',
      login: '',
      avatar_url: ''
    };

    this.createEditForm();

    // this.loginControl.valueChanges.subscribe(
    //   value => console.log({value})
    // );

    // this.editForm.valueChanges.subscribe(
    //   value => console.log({value})
    // );
  }
Example #7
Source File: admin-product.component.ts    From mslearn-live-azure-fundamentals with MIT License 6 votes vote down vote up
constructor(dataClient: DataClient, formatter: FormattingHelpers, route: ActivatedRoute, private formBuilder: FormBuilder, private router: Router) {

    this.formatter = formatter;
    this.data = dataClient;
    this.id = route.snapshot.paramMap.get("productId");

    this.isCreateNewMode = this.id == "$new";

    this.productForm = this.formBuilder.group({
      name: ['', Validators.required],
      description: ['', Validators.required],
      category: ['', Validators.required],
      price: ['', Validators.required],
      stockUnits: ['', Validators.required],
      thumbnailImage: ['', Validators.required]
    });

    this.hasLoaded = true;
  }
Example #8
Source File: onboarding.page.ts    From mylog14 with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    private readonly formBuilder: FormBuilder,
    private readonly loadingService: LoadingService,
    private readonly privateCouponService: PrivateCouponService,
    private readonly router: Router,
    private readonly toastController: ToastController,
    private readonly translate: TranslateService,
    private readonly dataStore: DataStoreService,
    public readonly langaugeService: LanguageService,
  ) { }
Example #9
Source File: location-creation.component.ts    From pantry_party with Apache License 2.0 6 votes vote down vote up
constructor(
    private grocyService: GrocyService,
    private routerExtensions: RouterExtensions,
    private _fb: FormBuilder,
    stateTransfer: StateTransferService
  ) {
    const passedState = stateTransfer.readAndClearState();

    if (passedState && passedState.type === "locationCreation") {
      this.selectionCallback = passedState.callback;
    }
  }
Example #10
Source File: browser-outlet.component.ts    From scion-microfrontend-platform with Eclipse Public License 2.0 6 votes vote down vote up
constructor(host: ElementRef<HTMLElement>,
              formBuilder: FormBuilder,
              private _activatedRoute: ActivatedRoute,
              private _overlay: Overlay,
              private _injector: Injector) {
    this.form = formBuilder.group({
      [URL]: new FormControl('', Validators.required),
    });
    this.appEntryPoints = this.readAppEntryPoints();
  }
Example #11
Source File: car-edit-form.component.ts    From ReCapProject-Frontend with MIT License 6 votes vote down vote up
constructor(
    private formBuilder: FormBuilder,
    private toastrService: ToastrService,
    private carService: CarService,
    private brandService: BrandService,
    private colorService: ColorService,
    private carImageService: CarImageService,
    private activatedRoute: ActivatedRoute,
    private router: Router
  ) {}
Example #12
Source File: tags-input.component.ts    From alauda-ui with MIT License 6 votes vote down vote up
constructor(
    cdr: ChangeDetectorRef,
    private readonly fb: FormBuilder,
    private readonly renderer: Renderer2,
    private readonly injector: Injector,
  ) {
    super(cdr);
    this.inputControl = this.fb.control('');
  }
Example #13
Source File: course-dialog.component.ts    From reactive-angular-course with MIT License 6 votes vote down vote up
constructor(
        private fb: FormBuilder,
        private dialogRef: MatDialogRef<CourseDialogComponent>,
        @Inject(MAT_DIALOG_DATA) course:Course,
        private coursesStore: CoursesStore,
        private messagesService: MessagesService) {

        this.course = course;

        this.form = fb.group({
            description: [course.description, Validators.required],
            category: [course.category, Validators.required],
            releasedAt: [moment(), Validators.required],
            longDescription: [course.longDescription,Validators.required]
        });

    }
Example #14
Source File: autocomplete-dialog.ts    From ASW-Form-Builder with MIT License 6 votes vote down vote up
constructor(private formBuilder: FormBuilder,
                public dialogRef: MatDialogRef<AswAutocompleteDialog>,
                @Inject(MAT_DIALOG_DATA) public control: AutoCompleteControl) {
        this.aswEditAutocompleteForm = this.formBuilder.group({
            tooltip: ['', [Validators.required]],
            label: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(25)]],
            name: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(25)]],
            style: ['', [Validators.required]],
            column: [],
            options: this.formBuilder.array([this.createOption()]),
            isRequired: [false]
        });
    }
Example #15
Source File: login.component.ts    From budget-angular with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    private authService: AuthService,
    private oauthService: OAuthService,
    private formBuilder: FormBuilder,
    private snackBar: MatSnackBar,
    private dialog: MatDialog,
    private route: ActivatedRoute,
    private router: Router
  ) {}
Example #16
Source File: create.component.ts    From blockcore-hub with MIT License 6 votes vote down vote up
constructor(
        private authService: AuthenticationService,
        private appState: ApplicationStateService,
        private router: Router,
        private fb: FormBuilder,
        private log: Logger,
        public dialog: MatDialog,
        public snackBar: MatSnackBar,
        private globalService: GlobalService,
        private apiService: ApiService) {

        this.onGenerate();
    }
Example #17
Source File: add-activity.component.spec.ts    From careydevelopmentcrm with MIT License 6 votes vote down vote up
describe('AddActivityComponent', () => {
  let component: AddActivityComponent;
  let fixture: ComponentFixture<AddActivityComponent>;

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      declarations: [AddActivityComponent],
      imports: [
        RouterTestingModule,
        HttpClientTestingModule
      ],
      providers: [
        AlertService,
        FormBuilder
      ]
    })
    .compileComponents();
  });

  beforeEach(() => {
    fixture = TestBed.createComponent(AddActivityComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});
Example #18
Source File: login.component.ts    From angular-10-basic-authentication-example with MIT License 6 votes vote down vote up
constructor(
        private formBuilder: FormBuilder,
        private route: ActivatedRoute,
        private router: Router,
        private authenticationService: AuthenticationService
    ) { 
        // redirect to home if already logged in
        if (this.authenticationService.userValue) { 
            this.router.navigate(['/']);
        }
    }
Example #19
Source File: login.component.ts    From angular-10-jwt-authentication-example with MIT License 6 votes vote down vote up
constructor(
        private formBuilder: FormBuilder,
        private route: ActivatedRoute,
        private router: Router,
        private authenticationService: AuthenticationService
    ) { 
        // redirect to home if already logged in
        if (this.authenticationService.currentUserValue) { 
            this.router.navigate(['/']);
        }
    }
Example #20
Source File: login.component.ts    From angular-10-jwt-refresh-tokens with MIT License 6 votes vote down vote up
constructor(
        private formBuilder: FormBuilder,
        private route: ActivatedRoute,
        private router: Router,
        private authenticationService: AuthenticationService
    ) { 
        // redirect to home if already logged in
        if (this.authenticationService.userValue) { 
            this.router.navigate(['/']);
        }
    }
Example #21
Source File: login.component.ts    From angular-10-role-based-authorization-example with MIT License 6 votes vote down vote up
constructor(
        private formBuilder: FormBuilder,
        private route: ActivatedRoute,
        private router: Router,
        private authenticationService: AuthenticationService
    ) { 
        // redirect to home if already logged in
        if (this.authenticationService.userValue) { 
            this.router.navigate(['/']);
        }
    }
Example #22
Source File: login.component.ts    From angular-9-jwt-authentication-example with MIT License 6 votes vote down vote up
constructor(
        private formBuilder: FormBuilder,
        private route: ActivatedRoute,
        private router: Router,
        private authenticationService: AuthenticationService
    ) { 
        // redirect to home if already logged in
        if (this.authenticationService.currentUserValue) { 
            this.router.navigate(['/']);
        }
    }
Example #23
Source File: chatroom.component.ts    From angular-9-firebase-chat-example with MIT License 6 votes vote down vote up
constructor(private router: Router,
              private route: ActivatedRoute,
              private formBuilder: FormBuilder,
              public datepipe: DatePipe) {
                this.nickname = localStorage.getItem('nickname');
                this.roomname = this.route.snapshot.params.roomname;
                firebase.database().ref('chats/').on('value', resp => {
                  this.chats = [];
                  this.chats = snapshotToArray(resp);
                  setTimeout(() => this.scrolltop = this.chatcontent.nativeElement.scrollHeight, 500);
                });
                firebase.database().ref('roomusers/').orderByChild('roomname').equalTo(this.roomname).on('value', (resp2: any) => {
                  const roomusers = snapshotToArray(resp2);
                  this.users = roomusers.filter(x => x.status === 'online');
                });
              }
Example #24
Source File: ranking.component.ts    From oss-github-benchmark with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    private dataService: DataService,
    private route: ActivatedRoute,
    public dialog: MatDialog,
    private location: Location,
    fb: FormBuilder
  ) {
    this.sort = new MatSort();
    this.sectorFilters.forEach(
      (sector: { sector: string; activated: boolean }) => {
        if (sector.activated) {
          this.checkboxes.push(sector.sector);
        }
      }
    );
  }
Example #25
Source File: signup.page.ts    From contact-tracer with MIT License 6 votes vote down vote up
constructor(
        public formBuilder: FormBuilder,
        private navController: NavController,
        private authService: AuthService
    ) {
        this.signupForm = formBuilder.group({
            phone: ['+', Validators.compose([Validators.required])]
        });

        this.verifyForm = formBuilder.group({
            code: ['', Validators.compose([Validators.required])]
        });
    }
Example #26
Source File: create.component.ts    From EXOS-Core with MIT License 6 votes vote down vote up
constructor(
        private authService: AuthenticationService,
        private appState: ApplicationStateService,
        private router: Router,
        private fb: FormBuilder,
        private log: Logger,
        public dialog: MatDialog,
        public snackBar: MatSnackBar,
        private globalService: GlobalService,
        private apiService: ApiService) {

        this.onGenerate();
    }
Example #27
Source File: new-password.page.ts    From fyle-mobile-app with MIT License 6 votes vote down vote up
constructor(
    private fb: FormBuilder,
    private activatedRoute: ActivatedRoute,
    private loaderService: LoaderService,
    private routerAuthService: RouterAuthService,
    private authService: AuthService,
    private popoverController: PopoverController,
    private trackingService: TrackingService,
    private deviceService: DeviceService,
    private loginInfoService: LoginInfoService
  ) {}
Example #28
Source File: create.snippet.component.ts    From dbm with Apache License 2.0 5 votes vote down vote up
constructor(private editorService: EditorService,
              private modal: NzModalService,
              private formBuilder: FormBuilder,
              private snippetService: SnippetService,
              private messageService: NzMessageService,
              private translateService: TranslateService) {
    super();
  }
Example #29
Source File: add-blog.component.ts    From Collab-Blog with GNU General Public License v3.0 5 votes vote down vote up
constructor(private blogService:BlogsService, private fb:FormBuilder, private router:Router) { }