Pen Settings



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


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


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.


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 ng-app="ionicApp">
    <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="//" rel="stylesheet">
    <script src="//"></script>

  <body ng-controller="MainCtrl">


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

          <ion-nav-bar class="bar-positive">

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

          <ion-nav-view name="menuContent"></ion-nav-view>

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


    <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="" placeholder="Search" disabled>
            <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">
                <select disabled>
                  <option selected>{{ userYear.year }}</option>
          <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">
                <div class="col">
                  <div class="select" style="padding: 7px 0px 0px 7px;">
                    {{ userYear.year }}
    <script id="templates/searchSelect.html" type="text/ng-template">
          <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;" />
            <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 class="title" ng-if="!searchSelect.enableSearch">{{ searchSelect.title }}</h1>
          <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] }}
            <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 }}


                body {
  cursor: url(''), 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%;


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

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

    .state('eventmenu', {
      url: "/event",
      abstract: true,
      templateUrl: "templates/event-menu.html"
    .state('eventmenu.home', {
      url: "/home",
      views: {
        'menuContent' :{
          templateUrl: "templates/home.html"
.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++){
.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];
                  $scope.searchSelect.option = $scope.optionSelected;
            }, $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;
                $scope.optionSelected = $scope.searchSelect.option;
                $scope.searchSelect.searchvalue = "";
            $scope.clearSearch = function () {
                $scope.searchSelect.searchvalue = "";

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