2017-07-16 18:41:01 +00:00
|
|
|
import {Component, OnInit} from '@angular/core';
|
|
|
|
import {AngularFireDatabase, FirebaseListObservable} from 'angularfire2/database';
|
|
|
|
import {ActivatedRoute, Data} from '@angular/router';
|
|
|
|
import {MailModel} from './mail.model';
|
2017-07-08 16:12:52 +00:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector : 'fuse-mail',
|
|
|
|
templateUrl: './mail.component.html',
|
|
|
|
styleUrls : ['./mail.component.scss']
|
|
|
|
})
|
|
|
|
export class MailComponent implements OnInit
|
|
|
|
{
|
2017-07-15 15:03:40 +00:00
|
|
|
mails: FirebaseListObservable<any[]>;
|
2017-07-16 18:41:01 +00:00
|
|
|
selectedMail: MailModel;
|
2017-07-08 16:12:52 +00:00
|
|
|
|
2017-07-15 15:03:40 +00:00
|
|
|
constructor(private db: AngularFireDatabase, private route: ActivatedRoute)
|
2017-07-08 16:12:52 +00:00
|
|
|
{
|
2017-07-15 15:03:40 +00:00
|
|
|
console.log('mail component inited');
|
|
|
|
|
|
|
|
// this.mails = db.list('/mail/data');
|
|
|
|
|
|
|
|
/*this.mails.subscribe(response =>
|
|
|
|
{
|
|
|
|
console.log(response);
|
|
|
|
|
|
|
|
console.log('going offline...');
|
|
|
|
this.db.database.goOffline();
|
|
|
|
});*/
|
2017-07-08 16:12:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit()
|
|
|
|
{
|
2017-07-15 15:03:40 +00:00
|
|
|
this.route.data.subscribe((data: Data) =>
|
|
|
|
{
|
|
|
|
console.warn(data['mails']);
|
|
|
|
});
|
2017-07-08 16:12:52 +00:00
|
|
|
}
|
2017-07-16 18:41:01 +00:00
|
|
|
|
|
|
|
onMailSelect(mail)
|
|
|
|
{
|
|
|
|
console.info('on mail select', mail);
|
|
|
|
this.selectedMail = mail;
|
|
|
|
}
|
2017-07-08 16:12:52 +00:00
|
|
|
}
|