Skip to content
This repository has been archived by the owner on Feb 9, 2019. It is now read-only.

fixes tslint errors #3

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { routes } from './app.routes';
CommonModule,
RouterModule.forRoot(routes)
],
exports: [ RouterModule ],
exports: [RouterModule],
declarations: []
})
export class AppRoutingModule { }
export class AppRoutingModule { }
4 changes: 2 additions & 2 deletions src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { Routes } from '@angular/router';
import { HomeComponent } from './home/home.component';

export const routes: Routes = [
{ path: '', component: HomeComponent }
];
{ path: '', component: HomeComponent }
];
14 changes: 7 additions & 7 deletions src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class HomeComponent implements OnInit {
'required': 'Entity value is required.',
'minlength': 'Entity value must be at least 2 characters long.'
},
}
};

constructor(private formBuilder: FormBuilder, private trainingDataService: TrainingDataService) { this.createForm(); }

Expand All @@ -67,12 +67,12 @@ export class HomeComponent implements OnInit {
onValueChanged(data?: any) {
if (!this.trainingDataForm) { return; }
const form = this.trainingDataForm;
for (const field in this.formErrors) {
for (const field of Object.keys(this.formErrors)) {
this.formErrors[field] = '';
const control = form.get(field);
if (control && control.dirty && !control.valid) {
const messages = this.validationMessages[field];
for (const key in control.errors) {
for (const key of Object.keys(control.errors)) {
this.formErrors[field] += messages[key] + ' ';
}
}
Expand All @@ -87,8 +87,8 @@ export class HomeComponent implements OnInit {

addData() {
if (this.trainingDataForm.valid) {
let entity = new Entity();
let entityDataTableEntry: any = {};
const entity = new Entity();
const entityDataTableEntry: any = {};
entity.start = entityDataTableEntry.start = this.selectionStart;
entity.end = entityDataTableEntry.end = this.selectionEnd;
entity.value = entityDataTableEntry.value = this.trainingDataForm.value.value;
Expand Down Expand Up @@ -133,7 +133,7 @@ export class HomeComponent implements OnInit {
confirmSubmit() {
swal({
title: 'Are you sure?',
text: "You won't be able to revert this!",
text: 'You won\'t be able to revert this!',
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
Expand All @@ -143,7 +143,7 @@ export class HomeComponent implements OnInit {
if (result.value) {
this.submitData();
}
})
});
}
submitData() {
this.trainingData.text = this.value;
Expand Down
6 changes: 3 additions & 3 deletions src/app/services/training-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { TrainingData } from '../shared/models/training-data.model';
@Injectable()
export class TrainingDataService {
API_ENDPOINT = environment.API_ENDPOINT;
constructor(private httpClient: HttpClient) { console.log(environment.API_ENDPOINT) }
constructor(private httpClient: HttpClient) { console.log(environment.API_ENDPOINT); }

submitTrainingData(trainingData: TrainingData) {
return this.httpClient.post(this.API_ENDPOINT, trainingData);
}

public extractData(res: Response) {
let body = res.json();
const body = res.json();
console.log(body);
return body || {};
}
Expand Down
10 changes: 5 additions & 5 deletions src/app/shared/models/entity.model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export class Entity {
start: number;
end: number;
value: string;
entity: string;
}
start: number;
end: number;
value: string;
entity: string;
}
6 changes: 3 additions & 3 deletions src/app/shared/models/training-data.model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Entity } from './entity.model';
export class TrainingData {
text: string;
entities: Entity[];
}
text: string;
entities: Entity[];
}