Urigo / meteor-angular-socially

angular-meteor example and tutorial app
https://www.angular-meteor.com/tutorials/socially/angular1/bootstrapping
155 stars 144 forks source link

15. Conditional template directives with AngularJS #115

Closed watalberto closed 8 years ago

watalberto commented 8 years ago

Would be possible to change the property to check if the fields must be disabled or not in partyDetails.html. The tutorial is checking if an user is logged but always we are on that view, we have an user logged, because Meteor won't allow to reach this view unless the user is logged. Moreover, be logged isn't the unique requirement to update a party, you also need to be the owner and that's why I propose check if the logged user is the owner of the party to know when disabled the fields and also the "save" button.

What I did is ng-disabled="!partyDetails.isOwner" and create the helper:

isOwner() {
  let party = this.getReactively('party')

  if (!party)
    return false;
  return Meteor.userId() === party.owner;
}

What do you think, could be this an improvement?

DAB0mB commented 8 years ago

Your'e right. Hopefully the fix will be deployed soon

Urigo commented 8 years ago

deployed