title: How to assign values in ngIf
body: <p>I'm new to Angular. I'm learning directives. I'm using <code>pTooltip</code> from <code>primeng</code>. But I want to display text in pTooltip according to a condition.</p>
  
  <p>Let's take example of Stack Overflow itself. You cannot upvote an answer twice. User should get msg1 if he has not upvoted that particular article otherwise he should get msg2. Where:</p>
  
  <pre><code>msg1="I found this article very useffeul.";
  msg2="You've already upvoted this article";
  </code></pre>
  
  <p>Here is my code:</p>
  
  <p><strong>article.component.html</strong></p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;button 
    class="btn btn-success"
    *ngIf="allowUpvote ? pTooltip={{msg1}} : pTooltip={{msg2}}
    [disabled]="!allowUpvote"&gt;
    UPVOTE
  &lt;/button&gt;
  </code></pre>
  
  <p><strong>article.component.ts</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>...
  allowUpvote=true;
  msg1="I found this article very useffeul.";
  msg2="You've already upvoted this article";
  ...
  
  ngOnInit() {
    for(var i=0;i&lt;5;i++) {
      if(this.currentLoggedInUserId==this.articleDetails.upvotersList[i]) {
        this.allowUpvote=false; //It will be set false if the user is there in the upvoters list
      }
    }
  });
  </code></pre>
  
  <p>But I'm getting this error:</p>
  
  <blockquote>
    <p>Parser Error: Bindings cannot contain assignments at column 24 in [allowUpvote ? pTooltip={{msg1}} : pTooltip={{msg2}}]</p>
  </blockquote>
  
  <p>Please give me some directions.</p>