title: Angular error: The left-hand side of an assignment expression must be a variable or a property access
body: <p>Do not understand or know how to fix this error.</p>
  
  <p>This is the code. It seems to be something to do with pushItem function i think. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&gt; **app.component.ts**
  
  import { Component, NgModule } from '@angular/core';
  
  @Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
  })
  export class AppComponent {
    //bind this array to li in html
    items = ['Sistema', 'Playstation', 'Web'];
  
    newItem = '';
  
    pushItem = function() {
      if(this.newItem ! = ''){
        this.items.push(this.newItem);
        this.newItem = '';
      }
    }
  
  
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>@import '~font-awesome/css/font-awesome.css';
  
  .main{
      width: 500px;
      text-align: center;
      margin: 0 auto;
      border: 2px solid #d7d7d7;
      border-bottom: 0px;
      margin-top: 20px;
      font-family: sans-serif;
  }
  
  h1{
      text-align: center;
      background-color: #5c8297;
      padding: 30px 0px;
      margin-top: 0px;
      color: #f7f7f7;
  }
  
  .addItem{
      position: relative;
      padding-bottom: 0px;
      height: 30px;
  }
  
  .addText{
      width: 80%;
      height: 30px;
      padding: 5px;
      font-size: 20px;
  }
  
   button{
      height: 45px;
      width: 50px;
      padding: 5px;
  }
  
  ul{
      list-style: none;
      font-size: 20px;
      color: #686868;
      margin-left: -40px;
      margin-bottom: 0px;
  }
  
  li{
      border-bottom: 1px solid #bfbfbf;
      background: #d7d7d7;
      padding: 10px 0px;
      margin-bottom: 5px;
  }
  
  span{
      cursor: pointer;
      position: relative;
      float: right;
      margin-right: 15px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&gt; **app.component.html**
  
  &lt;div class = 'main'&gt; 
    &lt;h1&gt;Item List&lt;/h1&gt;
    &lt;div class = 'add'&gt;
      &lt;input [(ngModel)] = 'newItem' placeholder="add item" class = 'addText'&gt;
      &lt;button&gt;Add&lt;/button&gt;
    &lt;/div&gt;
    &lt;ul&gt;
      &lt;Li *ngFor = 'let i of items'&gt;
        {{i}} 
        &lt;span&gt;&lt;i class="fa fa-times" aria-hidden="true"&gt;&lt;/i&gt;&lt;/span&gt;
      &lt;/Li&gt;
    &lt;/ul&gt; 
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://i.stack.imgur.com/0WSHS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0WSHS.png" alt="Error nessage"></a></p>