remove redundant redux actions from components, added validation patterns /...

remove redundant redux actions from components, added validation patterns / enable form validation in application.form.main component, updated sector.courses component
parent eda0c210
......@@ -2,8 +2,7 @@ import { STUDENTDATAFIELDS_SAVE, STUDENTDATAFIELDS_RECEIVED } from '../constants
import { Injectable } from '@angular/core';
import { NgRedux } from 'ng2-redux';
import { IAppState } from '../store';
//import { HelperDataService } from '../services/helper-data-service';
import { UserDataService } from '../services/user-data-service';
//import { UserDataService } from '../services/user-data-service';
@Injectable()
......
export class AppSettings {
public static get API_ENDPOINT(): string {
return 'http://localhost/dist';
// return 'http://localhost/drupal-8.2.5';
// return 'http://localhost/dist';
return 'http://localhost/drupal-8.2.5';
// return 'http://eepal.dev/drupal';
// return 'http://eduslim2.minedu.gov.gr/drupal';
}
......
......@@ -27,7 +27,7 @@ import { APP_ROUTER_PROVIDERS, APP_DECLARATIONS } from './app.routes';
/* Here we import services */
import {HelperDataService} from './services/helper-data-service';
import {UserDataService} from './services/user-data-service';
//import {UserDataService} from './services/user-data-service';
import { ACTION_PROVIDERS } from './actions';
import Home from './components/home';
......@@ -69,9 +69,9 @@ class MyLocalization extends NgLocalization {
{ provide: NgLocalization, useClass: MyLocalization },
DevToolsExtension,
ACTION_PROVIDERS,
// Service1, again services here
//Service1, again services here
HelperDataService,
UserDataService,
//UserDataService,
]
})
class AppModule {}
......
<div class="row equal">
<div class="col-md-8">
<form novalidate [formGroup]="studentDataGroup">
<form novalidate (ngSubmit)="onSubmit(studentDataGroup)" [formGroup]="studentDataGroup">
<div *ngFor="let studentDataField$ of studentDataFields$ | async; "> </div>
<div class="form-group">
<label for="studentAmka">ΑΜΚΑ μαθητή</label><input class="form-control" type="text" formControlName="studentAmka">
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentAmka').touched && studentDataGroup.get('studentAmka').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentAmka').dirty && studentDataGroup.get('studentAmka').hasError('pattern')">
Επιτρέπονται μόνο ψηφία σε αυτό το πεδίο!
</div>
<div class="form-group">
<label for="studentFirstname">Όνομα μαθητή</label><input class="form-control" type="text" formControlName="studentFirstname">
......@@ -13,7 +19,7 @@
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentFirstname').touched && studentDataGroup.get('studentFirstname').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentFirstname').touched && studentDataGroup.get('studentFirstname').hasError('pattern')">
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentFirstname').dirty && studentDataGroup.get('studentFirstname').hasError('pattern')">
Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
</div>
......@@ -23,7 +29,7 @@
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentSurname').touched && studentDataGroup.get('studentSurname').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentSurname').touched && studentDataGroup.get('studentSurname').hasError('pattern')">
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentSurname').dirty && studentDataGroup.get('studentSurname').hasError('pattern')">
Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
</div>
......@@ -33,7 +39,7 @@
<div class="alert alert-danger" *ngIf="studentDataGroup.get('guardianFirstname').touched && studentDataGroup.get('guardianFirstname').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('guardianFirstname').touched && studentDataGroup.get('guardianFirstname').hasError('pattern')">
<div class="alert alert-danger" *ngIf="studentDataGroup.get('guardianFirstname').dirty && studentDataGroup.get('guardianFirstname').hasError('pattern')">
Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
</div>
......@@ -44,7 +50,7 @@
<div class="alert alert-danger" *ngIf="studentDataGroup.get('guardianSurname').touched && studentDataGroup.get('guardianSurname').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('guardianSurname').touched && studentDataGroup.get('guardianSurname').hasError('pattern')">
<div class="alert alert-danger" *ngIf="studentDataGroup.get('guardianSurname').dirty && studentDataGroup.get('guardianSurname').hasError('pattern')">
Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
</div>
......@@ -54,16 +60,34 @@
<div class="form-group">
<label for="regionAddress">Διεύθυνση κατοικίας</label><input class="form-control" type="text" formControlName="regionAddress">
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('regionAddress').touched && studentDataGroup.get('regionAddress').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('regionAddress').dirty && studentDataGroup.get('regionAddress').hasError('pattern')">
Δεν επιτρέπονται μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
</div>
</td>
<td>
<div class="form-group">
<label for="regionTK">TK </label><input class="form-control" type="text" formControlName="regionTK">
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('regionTK').touched && studentDataGroup.get('regionTK').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('regionTK').dirty && studentDataGroup.get('regionTK').hasError('pattern')">
Δεν επιτρέπονται γράμματα αλφαβήτου ή μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
</div>
</td>
<td>
<div class="form-group">
<label for="regionArea">Πόλη/Περιοχή</label><input class="form-control" type="text" formControlName="regionArea">
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('regionArea').touched && studentDataGroup.get('regionArea').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('regionArea').dirty && studentDataGroup.get('regionArea').hasError('pattern')">
Δεν επιτρέπονται μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
</div>
</td>
</tr>
</table>
......@@ -76,7 +100,7 @@
<option value="Απολυτήριο Λυκείου">Απολυτήριο Λυκείου</option>
</select>
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('certificateType').touched && studentDataGroup.get('certificateType').hasError('required')">
<div class="alert alert-danger" *ngIf="studentDataGroup.get('certificateType').dirty && studentDataGroup.get('certificateType').hasError('required')">
Η επιλογή από αυτή τη λίστα είναι απαραίτητη!
</div>
......@@ -87,7 +111,7 @@
<option value="Γονέας/Κηδεμόνας">Γονέας/Κηδεμόνας</option>
<option value="Μαθητής">Μαθητής</option>
</select>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('relationToStudent').touched && studentDataGroup.get('relationToStudent').hasError('required')">
<div class="alert alert-danger" *ngIf="studentDataGroup.get('relationToStudent').dirty && studentDataGroup.get('relationToStudent').hasError('required')">
Η επιλογή από αυτή τη λίστα είναι απαραίτητη!
</div>
</div>
......@@ -99,7 +123,7 @@
</button>
</div>
<div class="col-md-2">
<button type="button" class="btn-primary btn-lg pull-center" (click)="submitSelected()">
<button type="button" class="btn-primary btn-lg pull-center" (click)="submitSelected()" [disabled]="studentDataGroup.invalid">
Αποστολή<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
......
......@@ -8,7 +8,7 @@ import { NgRedux, select } from 'ng2-redux';
import { IStudentDataFields } from '../../store/studentdatafields/studentdatafields.types';
import { ICourseFields } from '../../store/coursefields/coursefields.types';
import { IAppState } from '../../store/store';
import { VALID_NAMES_PATTERN } from '../../constants';
import { VALID_NAMES_PATTERN, VALID_ADDRESS_PATTERN, VALID_ADDRESSTK_PATTERN, VALID_AMKA_PATTERN } from '../../constants';
import {
FormBuilder,
......@@ -34,6 +34,7 @@ import {
private _ngRedux: NgRedux<IAppState>,
private router: Router) {
this.studentDataGroup = this.fb.group({
/*
studentAmka: ['12346', Validators.required],
studentFirstname: ['ΝΙΚΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
studentSurname: ['ΚΑΤΣΑΟΥΝΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
......@@ -44,6 +45,17 @@ import {
regionArea: ['ΠΑΤΡΑ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
certificateType: ['Απολυτήριο Λυκείου', Validators.required],
relationToStudent: ['Μαθητής', Validators.required],
*/
studentAmka: ['12346', [Validators.pattern(VALID_AMKA_PATTERN),Validators.required]],
studentFirstname: ['ΝΙΚΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
studentSurname: ['ΚΑΤΣΑΟΥΝΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
guardianFirstname: ['ΑΝΑΣΤΑΣΙΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
guardianSurname: ['ΚΑΤΣΑΟΥΝΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
regionAddress: ['ΓΙΑΝΝΙΤΣΩΝ 5', [Validators.pattern(VALID_ADDRESS_PATTERN),Validators.required]],
regionTK: ['26334', [Validators.pattern(VALID_ADDRESSTK_PATTERN),Validators.required]],
regionArea: ['ΠΑΤΡΑ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
certificateType: ['Απολυτήριο Λυκείου', Validators.required],
relationToStudent: ['Μαθητής', Validators.required],
});
};
......@@ -57,13 +69,6 @@ import {
}
return state.studentDataFields;
});
this.courseFields$ = this._ngRedux.select(state => {
state.courseFields.reduce(({}, courseField) =>{
return courseField;
}, {});
return state.courseFields;
});
}
saveSelected() {
......
......@@ -36,11 +36,22 @@ import {AppSettings} from '../../app.settings';
<div class="row">
<div class="btn-group inline pull-center">
<button type="button" class="btn-primary btn-md pull-center" [disabled] = true>
<button type="button" class="btn-primary btn-md pull-center" (click)="defineCourse()" >
Η ειδικότητά μου<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
</div>
<!--
<div class="row">
<div class="btn-group inline pull-right">
<button class="btn-primary btn-md pull-right my-btn" type="button" (click)="defineCourse()" [hidden] = "numSelectedCourses === 0" >
Επαναφορά<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
</div>
-->
<ul class="list-group" style="margin-bottom: 20px;">
<div *ngFor="let sector$ of sectors$ | async;">
<div *ngFor="let course$ of sector$.courses;" >
......@@ -51,14 +62,6 @@ import {AppSettings} from '../../app.settings';
</div>
</ul>
<div class="row">
<div class="btn-group inline pull-right">
<button class="btn-primary btn-md pull-center my-btn" type="button" (click)="defineCourse()" [hidden] = "numSelectedSchools === 0" >
Επαναφορά<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
</div>
<div class="row">
<div class="btn-group inline pull-center">
<button type="button" id = "butsch" class="btn-primary btn-md pull-center" (click)="defineSchools()" [disabled] = "numSelectedSchools === 0 ">
......@@ -106,8 +109,7 @@ import {AppSettings} from '../../app.settings';
private studentDataFields$: Observable<IStudentDataFields>;
private courseActive = "-1";
private numSelectedSchools = <number>0;
private numSelectedCourses = <number>0;
//private numSelectedCourses = <number>0;
constructor(private _rsa: SectorCoursesActions,
private _rsb: RegionSchoolsActions,
......@@ -120,38 +122,28 @@ import {AppSettings} from '../../app.settings';
ngOnInit() {
this.courseActive = this.getCourseActive();
this._rsa.getSectorCourses(false);
this.sectors$ = this._ngRedux.select(state => {
let numsel = 0;
//let numsel = 0;
state.sectors.reduce((prevSector, sector) =>{
sector.courses.reduce((prevCourse, course) =>{
if (course.selected === true) {
numsel++;
//this.numSelectedCourses
}
//if (course.selected === true) {
// numsel++;
//}
return course;
}, {});
return sector;
}, {});
this.numSelectedCourses = numsel;
//this.numSelectedCourses = numsel;
return state.sectors;
});
//WORKED STRANGELY BEFORE..
/*
this.courseActive = this.getCourseActive();
this._rsb.getRegionSchools(this.courseActive);
*/
this._rsb.getRegionSchools(this.courseActive, false);
this.regions$ = this._ngRedux.select(state => {
let numsel = 0;
state.regions.reduce((prevRegion, region) =>{
region.epals.reduce((prevSchool, school) =>{
if (school.selected === true)
region.epals.reduce((prevEpal, epal) =>{
if (epal.selected === true)
numsel++;
return school;
return epal;
}, {});
return region;
}, {});
......@@ -159,7 +151,6 @@ import {AppSettings} from '../../app.settings';
return state.regions;
});
this._rsc.getSectorFields();
this.sectorFields$ = this._ngRedux.select(state => {
state.sectorFields.reduce(({}, sectorField) =>{
return sectorField;
......@@ -180,8 +171,25 @@ import {AppSettings} from '../../app.settings';
this.router.navigate(['/sector-fields-select']);
}
defineSchools() {
this.router.navigate(['/region-schools-select']);
}
definePersonalData() {
this.router.navigate(['/student-application-form-main']);
}
getCourseActive() {
const { sectors } = this._ngRedux.getState();
let l,m;
for ( l=0; l<sectors.size; l++)
if (sectors["_tail"]["array"][l]["sector_selected"] === true)
for ( m=0; m < sectors["_tail"]["array"][l]["courses"].length; m++)
if (sectors["_tail"]["array"][l]["courses"][m]["selected"] === true)
return sectors["_tail"]["array"][l]["courses"][m]["course_id"];
}
/*
defineCourse() {
//this._rsb.getRegionSchools_Reload("-1");
this._rsb.getRegionSchools("-1", true);
this.regions$ = this._ngRedux.select(state => {
let numsel = 0;
......@@ -197,8 +205,6 @@ import {AppSettings} from '../../app.settings';
return state.regions;
});
//this._rsa.getSectorCourses_Reload();
this._rsa.getSectorCourses(true);
this.sectors$ = this._ngRedux.select(state => {
state.sectors.reduce((prevSector, sector) =>{
......@@ -213,26 +219,10 @@ import {AppSettings} from '../../app.settings';
this.router.navigate(['/sectorcourses-fields-select']);
}
*/
defineSchools() {
this.router.navigate(['/region-schools-select']);
}
definePersonalData() {
this.router.navigate(['/student-application-form-main']);
}
getCourseActive() {
const { sectors } = this._ngRedux.getState();
let l,m;
for ( l=0; l<sectors.size; l++)
if (sectors["_tail"]["array"][l]["sector_selected"] === true)
for ( m=0; m < sectors["_tail"]["array"][l]["courses"].length; m++)
if (sectors["_tail"]["array"][l]["courses"][m]["selected"] === true)
return sectors["_tail"]["array"][l]["courses"][m]["course_id"];
}
defineCourse() {
this.router.navigate(['/sectorcourses-fields-select']);
}
}
......@@ -90,8 +90,8 @@ import {AppSettings} from '../../app.settings';
};
ngOnInit() {
this.courseActive = this.getCourseActive();
this.courseActive = this.getCourseActive();
this._rsa.getRegionSchools(this.courseActive, false);
this.regions$ = this._ngRedux.select(state => {
......@@ -99,8 +99,10 @@ import {AppSettings} from '../../app.settings';
state.regions.reduce((prevRegion, region) =>{
region.epals.reduce((prevEpal, epal) =>{
this.rss.push( new FormControl(epal.selected, []));
if (epal.selected === true)
if (epal.selected === true) {
numsel++;
console.log(epal.epal_name);
}
return epal;
}, {});
return region;
......
......@@ -3,8 +3,10 @@ import { Router } from '@angular/router';
import { Observable } from 'rxjs/Rx';
import { Injectable } from "@angular/core";
import { SectorCoursesActions } from '../../actions/sectorcourses.actions';
import { NgRedux, select } from 'ng2-redux';
import { ISectors } from '../../store/sectorcourses/sectorcourses.types';
import { RegionSchoolsActions } from '../../actions/regionschools.actions';
import { IRegions } from '../../store/regionschools/regionschools.types';
import { NgRedux, select } from 'ng2-redux';
import { IAppState } from '../../store/store';
import {
......@@ -27,7 +29,6 @@ import {AppSettings} from '../../app.settings';
<li class="list-group-item" (click)="setActiveSector(i)" [style.background-color]="toggleBackgroundColor(i)">
<h5>{{sector$.sector_name}}</h5>
</li>
<div *ngFor="let course$ of sector$.courses; let j=index;" [hidden]="i !== sectorActive">
<li class="list-group-item" >
<div class="row">
......@@ -65,15 +66,16 @@ import {AppSettings} from '../../app.settings';
})
@Injectable() export default class SectorCoursesSelect implements OnInit {
private sectors$: Observable<ISectors>;
private regions$: Observable<IRegions>;
private formGroup: FormGroup;
private rss = new FormArray([]);
private sectorActive = <number>-1;
private idx = <number>-1;
private sectorsList: Array<boolean> = new Array();
//private sectorsList = new Array([]);
constructor(private fb: FormBuilder,
private _rsa: SectorCoursesActions,
private _rsr: RegionSchoolsActions,
private _ngRedux: NgRedux<IAppState>,
private router: Router
) {
......@@ -83,9 +85,11 @@ import {AppSettings} from '../../app.settings';
};
ngOnInit() {
this._rsa.getSectorCourses(false);
let ids = 0;
//re-initialize schools-redux-state
this.getAllSchools();
this._rsa.getSectorCourses(true);
let ids = 0;
this.sectors$ = this._ngRedux.select(state => {
state.sectors.reduce((prevSector, sector) =>{
this.sectorsList[ids] = sector.sector_selected;
......@@ -93,7 +97,6 @@ import {AppSettings} from '../../app.settings';
//In case we want to preserve last checked option when we revisit the form
//if (sector.sector_selected === true)
//this.sectorActive = ids-1;
sector.courses.reduce((prevCourse, course) =>{
this.rss.push( new FormControl(course.selected, []));
//this.retrieveCheck();
......@@ -144,14 +147,22 @@ import {AppSettings} from '../../app.settings';
this.saveSelected();
}
/*
retrieveCheck() {
for (let i = 0; i < this.formGroup.value.formArray.length; i++)
if (this.formGroup.value.formArray[i] === true) {
this.idx = i;
return;
}
getAllSchools() {
//store in Redux the whole schools
this._rsr.getRegionSchools("-1", true);
this.regions$ = this._ngRedux.select(state => {
let numsel = 0;
state.regions.reduce((prevRegion, region) =>{
region.epals.reduce((prevEpal, epal) =>{
this.rss.push( new FormControl(epal.selected, []));
return epal;
}, {});
return region;
}, {});
return state.regions;
});
}
*/
}
......@@ -50,12 +50,12 @@ import {AppSettings} from '../../app.settings';
</div>
</div>
-->
</div>
<!--[disabled]="sectorActive === -1-->
<div class="row">
<div class="col-md-2 col-md-offset-5">
<button type="button" class="btn-primary btn-lg pull-center" (click)="navigateToSchools()" [disabled]="sectorActive === -1" >
<button type="button" class="btn-primary btn-lg pull-center" (click)="navigateToSchools()" [disabled]="true" >
Συνέχεια<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
......
......@@ -13,4 +13,8 @@ export const SECTORCOURSES_SELECTED_SAVE = 'SECTORCOURSES_SELECTED_SAVE';
export const STUDENTDATAFIELDS_RECEIVED = 'STUDENTDATAFIELDS_RECEIVED';
export const STUDENTDATAFIELDS_SAVE = 'STUDENTDATAFIELDS_SAVE';
export const VALID_NAMES_PATTERN = '[Α-ΩΆΈΉΊΎΌΏα-ωάέήίύόώ ]*$';
//export const VALID_NAMES_PATTERN = '[Α-ΩΆΈΉΊΎΌΏα-ωάέήίύόώ ]*$';
export const VALID_NAMES_PATTERN = '[A-Za-zΑ-ΩΆΈΉΊΎΌΏα-ωάέήίύόώ ]*$';
export const VALID_ADDRESS_PATTERN = '[0-9A-Za-zΑ-ΩΆΈΉΊΎΌΏα-ωάέήίύόώ ]*$';
export const VALID_ADDRESSTK_PATTERN = '[0-9 ]*$';
export const VALID_AMKA_PATTERN = '[0-9]*$';
......@@ -147,15 +147,3 @@
.form-group input[type="checkbox"]:checked + .btn-group > label span:last-child {
display: none;
}
.black-background {background-color:#000000;}
.white {color:#ffffff;}
.my-btn{
border-color: #116f2f;
background-color: #116f2f;
}
.my-btn:hover {
background: #1b8d3f;
color: #ffffff;
}
......@@ -6,6 +6,7 @@ import {
}
from '@angular/router';
import './globalstyles.css';
//import '../../myschool/main.scss';
import { DevToolsExtension, NgRedux, select } from 'ng2-redux';
import {
IAppState,
......
import {Http, Headers} from '@angular/http';
import {Injectable} from '@angular/core';
import {Observable} from "rxjs/Observable";
import 'rxjs/add/operator/map';
import { IStudentDataField } from '../store/studentdatafields/studentdatafields.types';
import {AppSettings} from '../app.settings';
const HEADER = { headers: new Headers({ 'Content-Type': 'application/json' }) };
@Injectable()
export class UserDataService {
constructor(private http: Http) {
};
getStudentDataFields() {
return new Promise((resolve, reject) => {
this.http.get(`${AppSettings.API_ENDPOINT}/studentList`)
.map(response => <IStudentDataField[]>response.json())
.subscribe(data => {
resolve(data);
}, // put the data returned from the server in our variable
error => {
console.log("Error HTTP GET Service"); // in case of failure show this message
reject("Error HTTP GET Service");
},
() => console.log("Student Data Fields Received"));//run this code in all cases); */
});
};
}
/*
import {Http, Headers} from '@angular/http';
import {Injectable} from '@angular/core';
import {Observable} from "rxjs/Observable";
import 'rxjs/add/operator/map';
//import { ICourseField } from '../store/coursefields/coursefields.types';
import { IStudentDataField } from '../store/studentdatafields/studentdatafields.types';
import {AppSettings} from '../app.settings';
const HEADER = { headers: new Headers({ 'Content-Type': 'application/json' }) };
@Injectable()
//export class HelperDataService {
export class UserDataService {
constructor(private http: Http) {
};
getStudentDataFields() {
return new Promise((resolve, reject) => {
//this.http.get(`${AppSettings.API_ENDPOINT}/coursefields/list`)
this.http.get(`${AppSettings.API_ENDPOINT}/studentList`)
.map(response => <IStudentDataField[]>response.json())
.subscribe(data => {
console.log(data);
resolve(data);
},
error => {
console.log("Error HTTP GET Service"); // in case of failure show this message
reject("Error HTTP GET Service");
},
() => console.log("Student Fields Received"));
});
};
}
*/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment