Skip to content

Commit

Permalink
Step 16.3: Add isOwner property
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha committed Nov 27, 2016
1 parent 1fb14d3 commit f45cb10
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions client/imports/app/parties/party-details.component.ts
Expand Up @@ -4,6 +4,7 @@ import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';
import { Meteor } from 'meteor/meteor';
import { MeteorObservable } from 'meteor-rxjs';
import { InjectUser } from "angular2-meteor-accounts-ui";

import 'rxjs/add/operator/map';

Expand All @@ -18,13 +19,15 @@ import template from './party-details.component.html';
selector: 'party-details',
template
})
@InjectUser('user')
export class PartyDetailsComponent implements OnInit, OnDestroy {
partyId: string;
paramsSub: Subscription;
party: Party;
partySub: Subscription;
users: Observable<User>;
uninvitedSub: Subscription;
user: Meteor.User;

constructor(
private route: ActivatedRoute
Expand Down Expand Up @@ -99,6 +102,10 @@ export class PartyDetailsComponent implements OnInit, OnDestroy {
});
}

get isOwner(): boolean {
return this.party && this.user && this.user._id === this.party.owner;
}

ngOnDestroy() {
this.paramsSub.unsubscribe();
this.partySub.unsubscribe();
Expand Down

0 comments on commit f45cb10

Please sign in to comment.