Murlidhar Fichadia
Murlidhar Fichadia

Reputation: 2609

Cannot find name Select - Ionic 3

I followed this tutorial : https://forum.ionicframework.com/t/ion-select-with-icon/63059/10 check last solution.

I want show select option menu on clicking an icon (which is placed on a header) like below:

enter image description here

But I get error : cannot find name 'Select', because of this build fails.

code

<ion-buttons end> 
 <button ion-button icon-only (click)="someFunc()" >
  <ion-icon name="icon-name"></ion-icon>
 </button>
</ion-buttons>

<ion-select #sectionSelect (ngModel)="selecteTopic" [selectOptions]="selectOptions" (ionChange)="topicChange($event,selecteTopic)">
  <ion-option value="0" selected="true">topic A</ion-option>
  <ion-option value="1">topic B</ion-option>
  <ion-option value="2">topic C</ion-option>
  <ion-option value="3">topic D</ion-option>
  <ion-option value="4">topic E</ion-option>
  <ion-option value="5">topic F</ion-option>
  <ion-option value="6">topic G</ion-option>
  <ion-option value="7">topic H</ion-option>
</ion-select>

typescript file

//Error here - cannot find name 'Select'
@ViewChild('sectionSelect') sectionSelect: Select;

selectOptions  =  {
  title: 'Location',
  subTitle: 'Select outlet location'
};

import { Component ,ViewChild } from '@angular/core';

someFunc(){
    this.sectionSelect.open();
    console.log('hello')
 }

Upvotes: 0

Views: 1219

Answers (1)

KarimMesallam
KarimMesallam

Reputation: 290

Make sure that you import the Select.

import { Select } from 'ionic-angular';

Upvotes: 1

Related Questions