Я пытаюсь вызвать http пост, используя функцию displayabsentpresent. Но он не вызывается. Консоль внутри подписки не выполняется. Это делается в angular. Я создаю текущую дату в ngonit, и вызывается displayAbsentPresent.printsundaymonday.
ngOnInit() {
/**Pass from current month onwards...*/
let dateObj = new Date();
let monthobj = dateObj.getUTCMonth(); //months from 1-12
let yearobj = dateObj.getUTCFullYear();
this.printsundaymonday(monthobj, yearobj);
console.log(+(monthobj +1) + "........date..........." + yearobj);
this.displayAbsentandPresent(+(monthobj +1),yearobj);
}
-======================================
displayAbsentandPresent(month,year) {
console.log(month+ "=================" +year);
this.postData={
"year" :year+"",
"month":month+"",
"studentid":3+""
};
//console.log(this.postData);
var options = { headers: new HttpHeaders({ 'Content-Type': 'text/plain' }) };
var count=0;
this.http.post("http://localhost/android/getattendance.php", JSON.stringify(this.postData),options)
.subscribe( (data) => {
console.log("Getting Post value;Checking inside post .."+data);
this.setUsersArray(data);
}
);
this.cd.markForCheck();
}
Здесь полный код
https://pastebin.com/raw/Q2QcwXU7
https://pastebin.com/raw/4X4qTDNE
Вот вид