diff options
author | Sonja Galovic <galovicsonja@gmail.com> | 2022-03-31 13:17:30 +0200 |
---|---|---|
committer | Sonja Galovic <galovicsonja@gmail.com> | 2022-03-31 13:17:30 +0200 |
commit | 39c2171b024b4dd6c6c918aac13fa988541d3291 (patch) | |
tree | 947ea966c44cd014d0c34b8d0408a2455f477dc8 /frontend/src/app/_services | |
parent | 6fd7dcd848effe906f79e814751f3a8a47b5fac5 (diff) |
Add-model - sredjen bag kod promene izvora podataka i ucitavanja pojedinih komponenti. Izbacena null vrednost iz selecta kod popunjavanja nedostajucih vrednosti.
Diffstat (limited to 'frontend/src/app/_services')
-rw-r--r-- | frontend/src/app/_services/csv-parse.service.ts | 8 |
1 files changed, 5 insertions, 3 deletions
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); |