Skip to content

Commit

Permalink
Step 21.27: Subscribe to the thumbs publication
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha committed Nov 27, 2016
1 parent d6256fe commit bc6bd1f
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions client/imports/app/parties/parties-upload.component.ts
@@ -1,22 +1,36 @@
import {Component} from '@angular/core';
import {Component, OnInit} from '@angular/core';

import template from './parties-upload.component.html';

import { upload } from '../../../../both/methods/images.methods';

import {Subject, Subscription} from "rxjs";
import {MeteorObservable} from "meteor-rxjs";

@Component({
selector: 'parties-upload',
template
})
export class PartiesUploadComponent {
export class PartiesUploadComponent implements OnInit {
fileIsOver: boolean = false;
uploading: boolean = false;
files: Subject<string[]> = new Subject<string[]>();
thumbsSubscription: Subscription;

constructor() {}

ngOnInit() {
this.files.subscribe((filesArray) => {
MeteorObservable.autorun().subscribe(() => {
if (this.thumbsSubscription) {
this.thumbsSubscription.unsubscribe();
this.thumbsSubscription = undefined;
}

this.thumbsSubscription = MeteorObservable.subscribe("thumbs", filesArray).subscribe();
});
});
}

fileOver(fileIsOver: boolean): void {
this.fileIsOver = fileIsOver;
}
Expand Down

0 comments on commit bc6bd1f

Please sign in to comment.