Im making a To Do App where it gets the Task from file B and then display it to file A, the problem is that I cant push an array from B to A and here is the error. Im still new to programming so please go easy on me...
here is the code :
src/pages/addtask/addtask.ts
import { Component } from '@angular/core';
import { NavController, IonicPage, NavParams } from 'ionic-angular';
import { HomePage } from '../home/home';
import { Storage } from '@ionic/storage'
@Component({
selector: 'page-task',
templateUrl: 'addtask.html'
})
export class AddTask {
// from here
tasks = []
post(){
this.tasks.push(this.tasks);
this.HomePage.avtasks.push(this.tasks);
}
constructor(public navCtrl: NavController, private storage: Storage, public HomePage) {
}
close(){
this.navCtrl.pop();
}
}
src/pages/home/home.ts
import { Component } from '@angular/core';
import { NavController, IonicPage, NavParams } from 'ionic-angular';
import { AddTask } from '../addtask/addtask'
import { Storage } from '@ionic/storage';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
// to here
avtasks:any[] = []
constructor(public navCtrl: NavController, private storage: Storage) {
}
openCT(){
this.navCtrl.push(AddTask);
}
}
Thanks in advance!