Tubiss
July 17, 2019, 1:33pm
1
this is my calendar how look like
ts file
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { Calendar } from '@ionic-native/calendar/ngx';
import { RmtServiceProvider } from '../../providers/rmt-service/rmt-service';
import {Http} from '@angular/http';
/**
* Generated class for the TakvimPage page.
*
* See https://ionicframework.com/docs/components/#navigation for more info on
* Ionic pages and navigation.
*/
@IonicPage()
export class CalendarPage {
currentEvents = [
{
year: 2019,
month: 2,
date: 25,
},
{
year: 2019,
month: 2,
date: 26,
}
];
constructor(public navCtrl: NavController , public navParams: NavParams,
public remoteService : RmtServiceProvider,public http: Http,) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad CalendarPage');
}
onDaySelect(e){
console.log(e);
}
onMonthSelect(e){
console.log(e);
}
onTitleSelect(e){
console.log(e);
}
goBackPage(){
this.navCtrl.push('HomePage');
}
}
html
<ion-content padding >
<mycal [events]="currentEvents" (onDaySelect)="onDaySelect($event)" (onMonthSelect)="onMonthSelect($event)" >
</mycal>
</ion-content>
provider
return new Promise(resolve => {
this.http.get('http://127.0.0.1:8000/api/lessons' )
.map(res => res.json())
.subscribe(data => {
this.data = data;
console.log(data);
resolve(this.data);
});
});
}
and my json like this
[{“name”:“firstlesson”, “start_time”:2019-09-22 17:13:02}]
how can ı display this on the calendar. ionic 3 angular 5
Hi
If I understood your problem correctly
You have to set date which comes in in below JSON.
[{“name”:“firstlesson”, “start_time”:2019-09-22 17:13:02}]
I think you can take reference from below solutions
Hi!
Firstly, the addition of ion-datetime is awesome - good work!
I may have missed this in the docs and apologies if so - how do I set the default date on selecting the control to todays date? When I open it it’s 01-01-2016. I’m setting ngModel to a field value (empty currently) - but I can set this field to any date and it will show up as that on loading (which is great). However is there an equivalent in Ionic 2 of DateTime.Now, e.g. [(ngModel)]=“DateTime.Now”?
Thanks!
Frank.
Your JSON is
[{“name”:“firstlesson”, “start_time”:2019-09-22 17:13:02}]
1.You can save this start_time in mydate variable
2. and once it will update it can set on calender.
Give a try.
Thanks
Tubiss
July 17, 2019, 2:15pm
3
how can ı set date because ı pull from json
[{“name”:“firstlesson”, “start_time”:2019-09-22 17:13:02},{“name”:“secondlesson”, “start_time”:2019-09-25 17:13:02},{“name”:“thirdlesson”, “start_time”:2019-09-27 17:13:02}]
my json api like this and ı didnt understood you sorry about that please help me ı new on ionic
Hello, could you describe what do you want step by step, please?
Tubiss
July 17, 2019, 2:36pm
5
ı have a json like above
and ı want to display this events into calendar
But how? Displaying it above the days, below the calendar itself?
Tubiss
July 19, 2019, 6:52am
7
ı have no idea , should ı firstly install a calendar or making something else please help me. Only ı need that ı should display event properly date on the calendar.
Sorry for be inactive for a week. I have found an ionic calendar tutorial from Simon Grimm . Is it what you were looking for?
Tubiss
July 24, 2019, 12:27pm
9
actually ı used to another calendar which is angular full calendar it works well and event display but ı want to load event from json dynamically . and ı have been open a new topic link is here
calendar.html
<full-calendar
defaultView="dayGridMonth"
[plugins]="calendarPlugins"
[weekends]="true"
[events]="[
{ title: 'event 1', date: '2019-06-07' },
{ title: 'event 2', date: '2019-06-12' }
]"
></full-calendar>
and this how look
[mycalend]
everything is fine but ı want load event from json instead of “[events]” array and ı made service
schedule.ts
export class ScheduleProvider {
constructor(public http: HttpClient) {
console.log('Hello Schedule…
so please help me.