title: Angular5 Cannot read property 'length' of undefined
body: <p>Hello I want to display a list of users data but I have put a condition on that if user data is greater than 0 then display otherwise not with help of <strong>length</strong> property in <code>*ngIf</code>, so my issue when I use this it gets error like <code>Cannot read property 'length' of undefined</code>,So please anyone help me.<br/>I also show same question on angular2 version but didn't help much.Here is my view.</p>
  
  <pre><code>&lt;div *ngIf="(studentListData | filter).length == 0"&gt;
     &lt;h3&gt;Sorry ..!data not found&lt;/h3&gt;
  &lt;/div&gt;
  
  &lt;div *ngIf="(studentListData | filter | filter ).length &gt; 0&gt;
     &lt;tr *ngFor="let student of studentListData | filtter; index as i;"&gt;
          // ** here is my td *//
     &lt;/tr&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>In my component</p>
  
  <pre><code>export class studentAllComponet implements OnInit {
    studentListData:any;
  
  getStudentList(){
          let studentList = this.studentService.getAllStudents();
          this.success(studentList)
      }
  
  success(data){
          this.studentListData = data;
          for (var i = 0; i &lt; this.studentListData.length; i++) {
              this.studentListData[i].name = this.studentListData[i].first_name +' '+ this.studentListData[i].last_name;
          }
      }
  
  }
  </code></pre>
  
  <p>In my filter </p>
  
  <pre><code>@Pipe({  name: 'filtter' })
  export class FiltterPipe implements PipeTransform{
     transform(value: any, args?: any): any {
          if (args != undefined &amp;&amp; args != null &amp;&amp; args != '') {
              return value.filter(data =&gt; (data.name.toLowerCase()).indexOf(args.toLowerCase()) &gt; -1);
          }
          return value;
      }
  }
  </code></pre>
  
  <p>Thanks in advance..!</p>