事件不呈现 http.post,没有控制台错误@fullcalendar/angular

问题描述 投票:0回答:0

我看过关于这个问题的所有其他帖子 我正在尝试使用从发布请求返回的对象数组填充完整日历。

这是我在 Angular 中的代码,我只发布了相关代码

events: any = this.returnArrayOfEvents();


calendarOptions: CalendarOptions = {
events: this.events
}
 returnArrayOfEvents() {
    let data = { "giornoInizio": 23, "meseInizio": 2, "annoInizio": 2023, "numeroDipendenti": 6,    "turniGiorno": 3, "giorniConsecutivi": 5, "numeroCicli": 2, "giornoInizioSett": 4 }

    return this.http.post('http://localhost:8081/turnON/gestioneTurni/generaTurni/list', data)
      .subscribe(res => {
        console.log(res)
      })    
      
    }

这是我的控制台

Array(30) [ {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, … ]
​
0: Object { title: "1", date: "2023-02-23T00:00:00" }
​
1: Object { title: "2", date: "2023-02-23T08:00:00" }
​
2: Object { title: "3", date: "2023-02-23T16:00:00" }
​
3: Object { title: "1", date: "2023-02-24T00:00:00" }
​
4: Object { title: "2", date: "2023-02-24T08:00:00" }
​
5: Object { title: "3", date: "2023-02-24T16:00:00" }
​
6: Object { title: "1", date: "2023-02-25T00:00:00" }
​
7: Object { title: "2", date: "2023-02-25T08:00:00" }
​
8: Object { title: "3", date: "2023-02-25T16:00:00" }
​
9: Object { title: "1", date: "2023-02-26T00:00:00" }
​
10: Object { title: "2", date: "2023-02-26T08:00:00" }
​
11: Object { title: "3", date: "2023-02-26T16:00:00" }
​
12: Object { title: "1", date: "2023-02-27T00:00:00" }
​
13: Object { title: "2", date: "2023-02-27T08:00:00" }
​
14: Object { title: "3", date: "2023-02-27T16:00:00" }
​
15: Object { title: "4", date: "2023-02-28T00:00:00" }
​
16: Object { title: "5", date: "2023-02-28T08:00:00" }
​
17: Object { title: "6", date: "2023-02-28T16:00:00" }
​
18: Object { title: "4", date: "2023-03-1T00:00:00" }
​
19: Object { title: "5", date: "2023-03-1T08:00:00" }
​
20: Object { title: "6", date: "2023-03-1T16:00:00" }
​
21: Object { title: "4", date: "2023-03-2T00:00:00" }
​
22: Object { title: "5", date: "2023-03-2T08:00:00" }
​
23: Object { title: "6", date: "2023-03-2T16:00:00" }
​
24: Object { title: "4", date: "2023-03-3T00:00:00" }
​
25: Object { title: "5", date: "2023-03-3T08:00:00" }
​
26: Object { title: "6", date: "2023-03-3T16:00:00" }
​
27: Object { title: "4", date: "2023-03-4T00:00:00" }
​
28: Object { title: "5", date: "2023-03-4T08:00:00" }
​
29: Object { title: "6", date: "2023-03-4T16:00:00" }
​
length: 30
​
<prototype>: Array []
turni.component.ts:78:16

只有在我没有像这样请求的情况下通过它才会渲染。 事件:任何= [{标题:“1”,日期:“2023-02-23T00:00:00”},{标题:“2”,日期:“2023-02-23T00:00:00”}]

如果我单击“下一步”和“返回”或更改时间gri,它不会呈现

如果我像这样添加一些日志:

  firstLog: string = this.logData("pre");
   events: any =  this.returnArrayOfEvents();
  secondLog: any = this.logData("post");

控制台将是:

pre turni.component.ts:61:12
post turni.component.ts:61:12
Array(30) [ {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, … ] 

也许这就是问题所在,但只有在发布请求以打字稿语言结束后,我如何才能控制“发布”?

angular fullcalendar fullcalendar-5
© www.soinside.com 2019 - 2024. All rights reserved.