Ionic 2 saving multiple calendar events

﹥>﹥吖頭↗ 提交于 2019-12-25 08:54:45

问题


I am currently experiencing a problem with my ionic calendar in that I am able to save input events in an array, retrieve the array and display the info on console. However I am unable to utilize the array and display the array in its original list. I am a noob at ionic:-) so any help will go a long way.

Here is my code so far:

//where data is received from a modal and received as(data)    
modal.onDidDismiss(data =>{
      if (data){
        let eventData=data;
        eventData.startTime= new Date(data.startTime);
        eventData.endTime= new Date(data.endTime);

    //initialization of array

//this is where the array is displayed

        let events=this.eventSource;
        events.push(eventData);
        this.eventSource=[];
        setTimeout(() =>{
          this.eventSource=events;
        });
//saving the array of events

        this.storage.set('data1',JSON.stringify(events));
      }

    });
    }

//once view is loaded the saved array should display as before the page is closed.
      ionViewWillEnter() {
        console.log("Showing the first page!");
        this.storage.get('data1').then((data1)=>{

          if(data1){
            console.log(JSON.parse(data1));

            return JSON.parse(data1);

          }



        });

来源:https://stackoverflow.com/questions/45924904/ionic-2-saving-multiple-calendar-events

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!