title: Enable/disable buttons with Angular
body: <p>I'm making an web-app in angular 4 and there is a question i came up with.
  It's the following:</p>
  
  <p>I use a property called currentLesson. This property has a variable number from 1 to 6. 
  In my component I have an list of 6 lessons where each lesson has it's own button to start this lesson.</p>
  
  <p>In this list it should only be available to click the button when the currentLesson has the value of the number of the lesson:</p>
  
  <p>Button of lesson 1 is active when : currentLesson = 1</p>
  
  <p>Button of lesson 2 is active when : currentLesson = 2</p>
  
  <p>Etc. etc.</p>
  
  <p>So if currentLesson = 2, the buttons of lesson 1, 3, 4, 5 and 6 should be disabled.</p>
  
  <p>I have the following set-up but it doesn't seem to work.
  In my component i have:</p>
  
  <pre><code>export class ClassComponent implements OnInit {
    classes = [
  {
    name: 'string',
    level: 'string',
    code: 'number',
    currentLesson: '1'
  }]
  
  
  
  checkCurrentLesson1 = function(classes) {
  if (classes.currentLesson = 1) { 
   return true;
  }
  else {
   return false;
  }
  };
  
  checkCurrentLesson2 = function(classes) {
  if (classes.currentLesson = 2) {
   return true;
  }
  else {
   return false;
  }
  };
  </code></pre>
  
  <p>And my html file is like this:</p>
  
  <pre><code> &lt;ul class="table lessonOverview"&gt;
      &lt;li&gt;
        &lt;p&gt;Lesson 1&lt;/p&gt;
        &lt;button [routerLink]="['/lesson1']" 
           [disabled]="!checkCurrentLesson1" class="primair"&gt;
             Start lesson&lt;/button&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;p&gt;Lesson 2&lt;/p&gt;
        &lt;button [routerLink]="['/lesson2']" 
           [disabled]="!checkCurrentLesson2" class="primair"&gt;
             Start lesson&lt;/button&gt;
      &lt;/li&gt;
   &lt;/ul&gt;
  </code></pre>
  
  <p>(I only printed two of the six lessons, but they are all the same)</p>
  
  <p>Has anyone an solution or idea for me?</p>
  
  <p>Thanks in advance,</p>
  
  <p>Maarten</p>