Skip to content

Commit

Permalink
[#6] Removed Oninit and tried Unique name
Browse files Browse the repository at this point in the history
  • Loading branch information
nirojdyola committed Dec 22, 2017
1 parent d53bbd6 commit 800bb44
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/app/register/register.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
import { CouchService } from '../shared/couchdb.service';
import { FormsModule } from '@angular/forms';
import { FormBuilder, FormControl, FormGroup, Validators, FormControlName } from '@angular/forms';
Expand All @@ -13,7 +13,7 @@ import { UserData } from './UserData';
templateUrl: './register.component.html',
styleUrls: [ './register.component.scss' ]
})
export class RegisterComponent implements OnInit {
export class RegisterComponent {

registerForm: FormGroup;
educationLevel = [ '1', '2', '3', '4', '5', '6' , '7', '8', '9', '11', '12', 'Higher' ];
Expand Down Expand Up @@ -71,16 +71,16 @@ export class RegisterComponent implements OnInit {
this.RegistrationMsg = 'Error, Could not register';
});
}
isUserNameUnique(UserInfo: UserData) {
return this.ValidatorService.checkUnique('_users', UserInfo.login);
}
// isUserNameUnique(UserInfo: UserData) {
// return this.ValidatorService.checkUnique('_users', UserInfo.login);
// }

createform() {
this.registerForm = this.fg.group({
firstName: [ '', Validators.required ],
middleName: [ '', Validators.required ],
lastName: [ '', Validators.required ],
login: [ '', Validators.required, ac => this.validatorService.isUnique$(this.dbName, 'name', ac ],
login: [ '', Validators.required, ac => this.validatorService.isUnique$(this.dbName, 'name', ac) ],
Emails: [ '', [ Validators.required, Validators.pattern ('[^ @]*@[^ @]*') ] ],
password: [ '', Validators.required ],
repeatPassword: [ '', Validators.required ],
Expand Down

0 comments on commit 800bb44

Please sign in to comment.