title: Angular 2 ngFor and ngIf
body: <p>I have a dropdown menu which contains a checkbox and the name of projects. I added an ngModel to check if the project should be included in a list of projects (isChecked). The following code is in the view:</p>
  
  <pre><code>&lt;div id="dropdown-menu"&gt;
          &lt;button id="show-users" (click)="showMenu = !showMenu"&gt;Project toevoegen&lt;/button&gt; 
          &lt;div id="drp-project-select"&gt;
              &lt;div class="scroller" [hidden]="!showMenu"&gt;
                  &lt;div id="search-wrapper"&gt;
                      &lt;i class="fa fa-search"&gt;&lt;/i&gt;
                      &lt;input [(ngModel)]="searchTerm" type="text" placeholder="Zoek op naam..." &gt;
                  &lt;/div&gt;   
                  &lt;ul&gt;
                      &lt;li *ngFor="#project of projectdata.LoginResponse?.ProjectVM, #i = index"&gt;
                          &lt;label class="checkbox-label" &gt;
                              &lt;input type="checkbox" class="dropdown-checkbox" [(ngModel)]="project.isChecked" &gt;
                              &lt;span&gt;{{project.Project}}&lt;/span&gt;
                          &lt;/label&gt;
                      &lt;/li&gt;
                  &lt;/ul&gt;
  
  
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>I then try to get the checked items in a list but that doesn't seem to work. I know I am doing something wrong but I cannot figure out what. I tried the elvis operator on different places, but none of the places work so that's not it (I think) </p>
  
  <pre><code>&lt;ul&gt;
      &lt;li *ngFor="#checked of projectdata.?LoginResponse?.ProjectVM?.isChecked"&gt;
              &lt;span&gt;{{checked}}--&lt;/span&gt;
      &lt;/li&gt;
  &lt;/ul&gt; 
  </code></pre>