Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(private authService: AuthService,
private formBuilder: FormBuilder,
private router: Router,
private usernameValidator: DebouncingUsernameValidator) {
// Setup each of our controls using the `Control` `API`
this.username = new Control('', Validators.compose([
Validators.required,
Validators.minLength(3),
Validators.maxLength(16),
]), usernameValidator.usernameTaken)
this.password = new Control('', Validators.compose([
Validators.required,
Validators.minLength(8),
Validators.maxLength(128)
]))
this.confirm = new Control('', Validators.compose([
Validators.required,
Validators.minLength(8),
Validators.maxLength(128)
]))
this.email = new Control('', Validators.compose([
Validators.required,
store.take(1).subscribe((s: any) => {
// s && s.18n - ensures testing works in all cases (since some tests dont use i18n state)
this.langForm = new ControlGroup({
lang: new Control(s && s.i18n ? s.i18n.lang : '')
});
});
it("should error when given nonsense values", () => {
expect(v(new Control(null))).toEqual({mdNumberRequired: true});
expect(v(new Control(undefined))).toEqual({mdNumberRequired: true});
expect(v(new Control('sunset'))).toEqual({mdNumberRequired: true});
});
});
constructor(private httpService: BaseHttpService, private formBuilder: FormBuilder, private nav: NavController, navParams: NavParams, private notificationService: NotificationService) {
this.form = formBuilder.group({
first_name: new Control('', Validators.compose([Validators.minLength(3), Validators.maxLength(50), Validators.required])),
last_name: new Control(''),
email: new Control('', Validators.compose([Validators.maxLength(50), ValidationService.emailValidator, Validators.required])),
password: new Control('', Validators.compose([Validators.minLength(6), Validators.maxLength(50), Validators.required]))
});
}
this.subscription = this.formService.getForm('community').subscribe(inputs => {
this.inputs = inputs;
let formControls = {};
for(let input of this.inputs) {
input.value = input.default ? input.default : '';
let validators = this.formService.createValidators(input);
formControls[input.id] = new Control('', Validators.compose(validators));
}
this.form = this.builder.group(formControls);
this.active = true;
},
errors => {
constructor (
private _authenticationService: AuthenticationService,
private _formBuilder: FormBuilder,
private _router: Router,
private _logger: LoggerService
) {
this.emailControl = new Control(
"",
Validators.compose([Validators.required, Email.validate])
);
this.passwordControl = new Control(
'',
Validators.compose([Validators.required, Validators.minLength(1)])
);
this.form = this._formBuilder.group({
email: this.emailControl,
password: this.passwordControl
});
}
constructor(private multilang: MultilingualService) {
this.langForm = new ControlGroup({
lang: new Control('en')
});
}
changeLang(e: any) {
import * as constants from '../../config/constants';
@Component({
templateUrl: 'build/pages/group/group.html',
//styleUrls: ['./components/group/group.css'],
providers: [GroupService, ContactGroupService, ContactService, BaseHttpService, NotificationService],
directives: [FORM_DIRECTIVES]
})
export class GroupCmp {
form: ControlGroup;
id = new Control('');
name = new Control('', Validators.compose([Validators.maxLength(45), Validators.required]));
selectedContactId: number = null;
group: Group = new Group();
contactGroups: Array < ContactGroup > = [];
remainingContacts: Array < Contact > = [];
public groups: Group[] = [];
constructor(private notificationService: NotificationService, private groupService: GroupService, private contactService: ContactService, private contactGroupService: ContactGroupService, private formBuilder: FormBuilder, private nav: NavController, navParams: NavParams) {
var groupId: string = navParams.get('id');
if (groupId) {
let self = this;
var contactGroupParams = new URLSearchParams();
constructor(private http: Http) {
this.myForm = new ControlGroup({
productID: new Control()
});
}
templateUrl: './build/pages/contact-info/contact-info.html',
//styleUrls: ['./build/pages/contact-info/contact-info.css'],
providers: [ContactService, BaseHttpService, ContactGroupService, ContactInfoService, GroupService, NotificationService],
directives: [FORM_DIRECTIVES]
})
export class ContactInfoCmp {
form: ControlGroup;
id = new Control('');
address = new Control('', Validators.compose([Validators.minLength(2),Validators.maxLength(50), Validators.required]));
infoType = new Control('', Validators.required);
city = new Control('', Validators.compose([Validators.minLength(2),Validators.maxLength(50), Validators.required]));
state = new Control('', Validators.compose([Validators.minLength(2),Validators.maxLength(20), Validators.required]));
country = new Control('', Validators.compose([Validators.minLength(2),Validators.maxLength(20), Validators.required]));
email = new Control('', Validators.compose([Validators.maxLength(50), ValidationService.emailValidator, Validators.required]));
phone = new Control('', Validators.compose([Validators.maxLength(50),Validators.minLength(10), ValidationService.phoneNumberValidator, Validators.required]));
zip = new Control('', Validators.compose([Validators.maxLength(50),Validators.minLength(5), ValidationService.zipCodeValidator, Validators.required]));
infoTypes = ['home', 'work', 'mobile'];
contactInfo: ContactInfo = new ContactInfo();
contactGroups: Array < ContactGroup > = [];
remainingGroups: Array < Group > = [];
selectedGroupId: number = null;
constructor(private nav: NavController, navParams: NavParams, private formBuilder: FormBuilder, private contactInfoService: ContactInfoService, private httpService: BaseHttpService, private notificationService: NotificationService, private contactService: ContactService, private groupService: GroupService, private contactGroupService: ContactGroupService) {
var id: string = navParams.get('id');
this.contactInfo.contactId = navParams.get('contactId');
if (id) {