Permalink
Browse files

Step 16.1: Inject Meteor User and add isOwner method

  • Loading branch information...
1 parent 769c64f commit 0be0e459147611333b90031ee59d5a308765561f @dotansimha dotansimha committed with DAB0mB Sep 27, 2016
Showing with 7 additions and 0 deletions.
  1. +7 −0 client/imports/app/parties/parties-list.component.ts
@@ -5,6 +5,7 @@ import { Subscription } from 'rxjs/Subscription';
import { MeteorObservable } from 'meteor-rxjs';
import { PaginationService } from 'ng2-pagination';
import { Counts } from 'meteor/tmeasday:publish-counts';
+import { InjectUser } from "angular2-meteor-accounts-ui";
import 'rxjs/add/operator/combineLatest';
@@ -26,6 +27,7 @@ interface Options extends Pagination {
selector: 'parties-list',
template
})
+@InjectUser('user')
export class PartiesListComponent implements OnInit, OnDestroy {
parties: Observable<Party[]>;
partiesSub: Subscription;
@@ -36,6 +38,7 @@ export class PartiesListComponent implements OnInit, OnDestroy {
partiesSize: number = 0;
autorunSub: Subscription;
location: Subject<string> = new Subject<string>();
+ user: Meteor.User;
constructor(
private paginationService: PaginationService
@@ -104,6 +107,10 @@ export class PartiesListComponent implements OnInit, OnDestroy {
this.nameOrder.next(parseInt(nameOrder));
}
+ isOwner(party: Party): boolean {
+ return this.user && this.user._id === party.owner;
+ }
+
ngOnDestroy() {
this.partiesSub.unsubscribe();
this.optionsSub.unsubscribe();

0 comments on commit 0be0e45

Please sign in to comment.