Select elements within ion-view


#1

Please, how do I select an element thats within a ion-view, try using JS querySelector but its not picking it up.

Here is a snippet of my code. I want to select that “select” element.

<ion-tab title="Airtime Recharge" icon-on="ion-ios-keypad" icon-off="ion-ios-keypad-outline">
<ion-view view-title="" hide-back-button="true" hide-nav-bar="true">
<ion-content>
  <div class="sub_header">
    <i class="ion ion-android-menu" ng-click="toggleLeft()"></i>
    <i class="ion ion-log-out right-icon" ng-click="logOut()"></i>
    <h3>Ace Recharge</h3>
    <p>Quickly recharge your mobile phone.</p>
  </div>
  <div class="form-wrapper" style="background:#00b6ad">
    <section>
    <select class="cs-select cs-skin-elastic">
      <option value="" disabled selected>Select a Country</option>
      <option value="france" data-class="flag-france">France</option>
      <option value="brazil" data-class="flag-brazil">Brazil</option>
      <option value="argentina" data-class="flag-argentina">Argentina</option>
      <option value="south-africa" data-class="flag-safrica">South Africa</option>
    </select>
  </section>

#2

Hi,

Here is one way you can do this:

var currentView = document.querySelector('ion-view[nav-view="active"]');
var selectEl = currentView.querySelector("select");

Have you tried this?