Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <html ng-app="ionicApp">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">

    <title>Side Menus</title>

    <link href="//code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet">
    <script src="//code.ionicframework.com/nightly/js/ionic.bundle.js"></script>
  </head>

  <body ng-controller="MainCtrl">

    <ion-nav-view></ion-nav-view>

    <script id="templates/event-menu.html" type="text/ng-template">
      <ion-side-menus enable-menu-with-back-views="false">

        <ion-side-menu-content>
          <ion-nav-bar class="bar-positive">
            <ion-nav-back-button>
            </ion-nav-back-button>

            <ion-nav-buttons side="left">
              <button class="button button-icon button-clear ion-navicon" menu-toggle="left">
              </button>
            </ion-nav-buttons>
          </ion-nav-bar>

          <ion-nav-view name="menuContent"></ion-nav-view>
        </ion-side-menu-content> 

        <ion-side-menu side="left">
          <ion-header-bar class="bar-assertive">
            <h1 class="title">Left Menu</h1>
          </ion-header-bar>
          <ion-content>
          </ion-content>
        </ion-side-menu>

      </ion-side-menus>
    </script>

    <script id="templates/home.html" type="text/ng-template">
      <ion-view view-title="Directive to Search and Select One Option">
        <ion-content class="padding">
          <h3>Select an user</h3>
          <div class="item">
            <ion-search-select title="Search an User" key-property="id" value-property="name" options="editUser.users" option-selected="editUser.user">
              <label class="item item-input-inset" style="border:none;padding: 0px;cursor: pointer;">
                <div class="item-input-wrapper">
                  <i class="icon ion-ios-search"></i>
                  <input type="text" ng-model="editUser.user.name" placeholder="Search" disabled>
                </div>
              </label>
            </ion-search-select>
          </div>
            <h3>Select a year</h3>
            <ion-search-select title="Search a Year" enable-search="false" options="userYear.years" option-selected="userYear.year">
              <label class="item item-input item-select" style="cursor: pointer;">
                <div class="input-label">
                  Year
                </div>
                <select disabled>
                  <option selected>{{ userYear.year }}</option>
                </select>
              </label>
            </ion-search-select>
          <h3>Custom CSS</h3>
            <ion-search-select title="Search a Year" enable-search="false" options="userYear.years" option-selected="userYear.year">
              <label class="item item-input mylabel row" style="border: none;">
                <b class="input-label calm col">
                  Year:
                </b>
                <div class="col">
                  <div class="select" style="padding: 7px 0px 0px 7px;">
                    {{ userYear.year }}
                  </div>
                </div>
              </label>
            </ion-search-select>
        </ion-content>
      </ion-view>
    </script>
    <script id="templates/searchSelect.html" type="text/ng-template">
      <ion-modal-view>
        <ion-header-bar>
          <button class="button button-icon ion-close" ng-click="closeModal();"></button>
          <h1 class="title" style="right: 0 !important;" ng-if="searchSelect.enableSearch">
            <label class="item item-icon-left" style="height: 100%;top: -6px;padding: 0px 0px 0px 32px !important;">
              <i class="icon ion-android-search" style="font-size: 20px; left: 0 !important;top: 7px;"></i>
              <input type="text" placeholder="{{searchSelect.title}}" ng-model="searchSelect.searchvalue" style="width: 90%;height: 100%;margin-top: 7px;" />
            </label>
            <i ng-if="searchSelect.searchvalue.length > 0" on-tap="clearSearch()" class="icon ion-close" style="top:0px;right: 0px;position:absolute;cursor:pointer;z-index: 2;"></i>
          </h1>
          <h1 class="title" ng-if="!searchSelect.enableSearch">{{ searchSelect.title }}</h1>
        </ion-header-bar>
      <ion-content>
          <div class="list">
            <div ng-if="searchSelect.keyProperty && searchSelect.valueProperty">
              <ion-radio collection-repeat="option in options | filter: searchSelect.searchvalue" item-height="55px" item-width="100%" ng-value="option[searchSelect.keyProperty]" ng-click="saveOption()" ng-checked="option[searchSelect.selectedProperty]" ng-model="searchSelect.option">
                  {{ option[searchSelect.valueProperty] }}
              </ion-radio>
            </div>
            <div ng-if="!searchSelect.keyProperty || !searchSelect.valueProperty">
              <ion-radio collection-repeat="option in options | filter: searchSelect.searchvalue" item-height="55px" ng-value="option" item-width="100%" ng-click="saveOption()" ng-model="searchSelect.option">
                  {{ option }}
              </ion-radio>
            </div>
          </div>
      </ion-content>
    </ion-modal-view>
    </script>
  </body>
</html>
              
            
!

CSS

              
                body {
  cursor: url('https://ionicframework.com/img/finger.png'), auto;
}

.mylabel {
    position: relative;
}

.mylabel:after {
    content: '<>';
    font: 11px "Consolas", monospace;
    color: #aaa;
    -webkit-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
    -ms-transform: rotate(90deg);
    transform: rotate(90deg);
    right: 18px;
    top: 18px;
    padding: 0 0 2px;
    border-bottom: 1px solid #ddd;
    position: absolute;
    pointer-events: none;
}

.mylabel .select {
    padding: 3px;
    margin: 0;
    border: none;
    outline: none;
    display: inline-block;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    white-space: normal;
  -webkit-box-shadow: 0 3px 0 #ccc, 0 -1px #fff inset;
    -moz-box-shadow: 0 3px 0 #ccc, 0 -1px #fff inset;
    box-shadow: 0 3px 0 #ccc, 0 -1px #fff inset;
    background: #f8f8f8 !important;
    color: #888;
    height: 30px;
    -webkit-border-radius: 4px !important;
    -moz-border-radius: 4px !important;
    border-radius: 4px !important;
    width: 100%;
}
              
            
!

JS

              
                angular.module('ionicApp', ['ionic'])

.config(function($stateProvider, $urlRouterProvider) {

  $stateProvider
    .state('eventmenu', {
      url: "/event",
      abstract: true,
      templateUrl: "templates/event-menu.html"
    })
    .state('eventmenu.home', {
      url: "/home",
      views: {
        'menuContent' :{
          templateUrl: "templates/home.html"
        }
      }
    });
  
  $urlRouterProvider.otherwise("/event/home");
})
.controller('MainCtrl', function($scope, $timeout, $filter) { 
  
  $scope.editUser = {
    users : [
      {id: 1, name: "Valentina", selected: true},
      {id: 2, name: "Juan David", selected: false},
      {id: 3, name: "Osman", selected: false},
      {id: 4, name: "Silva", selected: false},
      {id: 5, name: "Andrea", selected: true},
      {id: 6, name: "Jhon", selected: false},
      {id: 7, name: "Williams", selected: false},
      {id: 8, name: "Yuli", selected: false}
    ],
    user: null
  };
  
  $scope.userYear = {
    years : [],
    year : 1942
  };
  
  var currentDate = new Date();
  for(var i = 1940; i <= currentDate.getFullYear(); i++){
    $scope.userYear.years.push(i);
  }
})
.directive('ionSearchSelect', ['$ionicModal', '$ionicGesture', function ($ionicModal, $ionicGesture) {
    return {
        restrict: 'E',
        scope: {
            options: "=",
            optionSelected: "="
        },
        controller: function ($scope, $element, $attrs) {
            $scope.searchSelect = {
                title: $attrs.title || "Search",
                keyProperty: $attrs.keyProperty,
                valueProperty: $attrs.valueProperty,
                templateUrl: $attrs.templateUrl || 'templates/searchSelect.html',
                animation: $attrs.animation || 'slide-in-up',
                option: null,
                searchvalue: "",
                enableSearch: $attrs.enableSearch ? $attrs.enableSearch == "true" : true
            };

            $ionicGesture.on('tap', function (e) {
              
                if(!!$scope.searchSelect.keyProperty && !!$scope.searchSelect.valueProperty){
                  if ($scope.optionSelected) {
                    $scope.searchSelect.option = $scope.optionSelected[$scope.searchSelect.keyProperty];
                  }
                }
                else{
                  $scope.searchSelect.option = $scope.optionSelected;
                }
                $scope.OpenModalFromTemplate($scope.searchSelect.templateUrl);
            }, $element);

            $scope.saveOption = function () {
              if(!!$scope.searchSelect.keyProperty && !!$scope.searchSelect.valueProperty){
                for (var i = 0; i < $scope.options.length; i++) {
                    var currentOption = $scope.options[i];
                    if(currentOption[$scope.searchSelect.keyProperty] == $scope.searchSelect.option){
                      $scope.optionSelected = currentOption;
                      break;
                    }
                }
              }
              else{
                $scope.optionSelected = $scope.searchSelect.option;
              }
                $scope.searchSelect.searchvalue = "";
                $scope.modal.remove();
            };
          
            $scope.clearSearch = function () {
                $scope.searchSelect.searchvalue = "";
            };

            $scope.closeModal = function () {
                $scope.modal.remove();
            };
            $scope.$on('$destroy', function () {
                if ($scope.modal) {
                    $scope.modal.remove();
                }
            });
          
            $scope.OpenModalFromTemplate = function (templateUrl) {
                $ionicModal.fromTemplateUrl(templateUrl, {
                    scope: $scope,
                    animation: $scope.searchSelect.animation
                }).then(function (modal) {
                    $scope.modal = modal;
                    $scope.modal.show();
                });
            };
        }
    };
} ]);
              
            
!
999px

Console