From 39c2171b024b4dd6c6c918aac13fa988541d3291 Mon Sep 17 00:00:00 2001 From: Sonja Galovic Date: Thu, 31 Mar 2022 13:17:30 +0200 Subject: Add-model - sredjen bag kod promene izvora podataka i ucitavanja pojedinih komponenti. Izbacena null vrednost iz selecta kod popunjavanja nedostajucih vrednosti. --- frontend/src/app/_services/csv-parse.service.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'frontend/src/app/_services/csv-parse.service.ts') diff --git a/frontend/src/app/_services/csv-parse.service.ts b/frontend/src/app/_services/csv-parse.service.ts index e44af238..4a05535a 100644 --- a/frontend/src/app/_services/csv-parse.service.ts +++ b/frontend/src/app/_services/csv-parse.service.ts @@ -2,7 +2,7 @@ import { Injectable } from "@angular/core"; @Injectable({ providedIn: 'root' }) export class CsvParseService { - csvToArray(strData: string, strDelimiter: string): string[][] { + csvToArray(strData: string, strDelimiter: string): (string | null)[][] { strDelimiter = (strDelimiter || ","); let objPattern = new RegExp( @@ -19,7 +19,7 @@ export class CsvParseService { "gi" ); - let arrData: string[][] = [[]]; + let arrData: (string | null)[][] = [[]]; let arrMatches = null; @@ -45,8 +45,10 @@ export class CsvParseService { strMatchedValue = arrMatches[3]; } - //if (strMatchedValue.length > 0) + if (strMatchedValue.length > 0) arrData[arrData.length - 1].push(strMatchedValue); + else + arrData[arrData.length - 1].push(null); } return (arrData); -- cgit v1.2.3