Search bar with objects won't show anything


#1

I want to show al my items inside a searchbar, i did looked up on internet but nothing works, im not gettting any error, but im not getting any item to show in my content. Here a leave my html and ts files. Variables are in spanish, sorry for that

<ion-header>
  <ion-toolbar color="danger">
    <ion-buttons start
                 [navPush]="home">
      <button ion-button icon-only color="white">
        <ion-icon name="ios-arrow-back"></ion-icon> Inicio
      </button>
    </ion-buttons>

    <ion-buttons end>
      <button ion-button
              clear color="white"
              [navPush]="listaTerminada">LISTO</button>
    </ion-buttons>
  </ion-toolbar>
</ion-header>


<ion-content padding class="backgroundd">
  <ion-searchbar (ionInput)="getItems($event)">
    <ion-list>
      <ion-item *ngFor="let articulo of listaProductos">{{articulo.nombre}}</ion-item>
    </ion-list>
  </ion-searchbar>
</ion-content>


import {Component, OnInit} from '@angular/core';
import { NavParams } from 'ionic-angular';
import {HomePage} from "../home/home";
import {ListaTerminadaPage} from "../lista-terminada/lista-terminada";
import {Articulo} from "../../Data/articulo.interface";

@Component({
  selector: 'page-elegiritems',
  templateUrl: 'elegiritems.html',
})
export class ElegiritemsPage implements OnInit{
  home=HomePage;
  listaTerminada=ListaTerminadaPage;
  listaProductos :Articulo[]=[];



  constructor(public navParams: NavParams) {
  }

  ngOnInit(){
    this.listaProductos = this.navParams.data;
  }

  getItems(ev:any){
    this.listaProductos = this.navParams.data;

    let val = ev.target.value;

    if (val && val.trim() != ''){
      this.listaProductos = this.listaProductos.filter((item: any) => {
        return (item.nombre.toLowerCase().indexOf(val.toLowerCase()) > -1);
      })
    }
  }
}

#2

What does that mean? A searchbar, by definition, shows a search and not items.

Look at the https://github.com/ionic-team/ionic-conference-app to get an idea for a searchbar that can filter a list - if that is what you are looking for.