Project

General

Profile

1
import { Component } from '@angular/core';
2
import { MyGroup } from '../../shared/reusablecomponents/forms/my-group.interface';
3
import { Validators } from '@angular/forms';
4

    
5
@Component ({
6
  selector: 'update-datasource-interface-form',
7
  templateUrl: 'update-datasource-interface-form.component.html'
8
})
9

    
10
export class UpdateDatasourceInterfaceFormComponent extends MyGroup {
11
  successMessage: string;
12
  errorMessage: string;
13
  existingValSet: boolean;
14

    
15
  readonly groupDefinition = {
16
    baseUrl: ['', Validators.required],
17
    selectValidationSet: [''],
18
    customValidationSet: [''],
19
    compatibilityLevel: ['', Validators.required]
20
  };
21

    
22

    
23
  ngOnInit(){
24
    super.ngOnInit();
25
    console.log(this.group,this.parentGroup);
26

    
27
    this.existingValSet = true;
28
    this.getMyControl('customValidationSet').disable();
29
  }
30

    
31

    
32
  chooseValSet(existingValSet: boolean) {
33
     if(existingValSet) {
34
       this.existingValSet = true;
35
       this.getMyControl('selectValidationSet').enable();
36
       this.getMyControl('customValidationSet').disable();
37
     }  else {
38
       this.existingValSet = false;
39
       this.getMyControl('selectValidationSet').disable();
40
       this.getMyControl('customValidationSet').enable();
41
     }
42
  }
43

    
44
  saveInterface(){
45
    console.log("saved  something!");
46
    if (this.existingValSet){
47
      console.log(this.getMyControl('selectValidationSet').value);
48
    } else {
49
      console.log(this.getMyControl('customValidationSet').value);
50
    }
51
  }
52
}
(12-12/12)