<html lang="en" ng-app="ui.bootstrap.demo">
    <head>
        <meta charset="UTF-8">
        <title>Text Box</title>
        <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
        <script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.13.0.js"></script>
        <script src="script.js"></script>
        <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
    </head>

    <body>
      Write here when ready
        <div id="ctrl-as-exmpl" ng-controller="DatepickerDemoCtrl">
            <drop-down user="users[0]"></drop-down>
        </div>
    </body>
</html>

angular.module('ui.bootstrap.demo', ['ui.bootstrap'])
  .directive('dropDown', function($compile) {
      return {
          
          restrict: 'E',
          
          scope: {
            user: '=user'
          },
          
          controller: function($scope) {
              
              $scope.addChild = function (child) {
                  var index = $scope.user.children.length;
                  $scope.user.children.unshift({
                      "parent": $scope.user,
                      "children": [],
                      "index": index
                  });
              }
              
              $scope.remove = function () {
                  if ($scope.user.parent) {
                    var parent = $scope.user.parent;
                    var index = parent.children.indexOf($scope.user);
                    parent.children.splice(index, 1);
                  }
              }
          },
          
          templateUrl: 'dropdown.tpl.html',
          
          link: function ($scope, $element, $attrs) {
            
          },
          
          compile: function(tElement, tAttr) {
              var contents = tElement.contents().remove();
              var compiledContents;
              return function(scope, iElement, iAttr) {
                  if(!compiledContents) {
                      compiledContents = $compile(contents);
                  }
                  compiledContents(scope, function(clone, scope) {
                           iElement.append(clone); 
                  });
              };
          }
      };
  });
  

angular.module('ui.bootstrap.demo').controller('DatepickerDemoCtrl', function ($scope) {
    
    $scope.users = [{
        "parent": null,
        "children": [],
        "index": 0
    }]
    
    $scope.today = function () {
        $scope.dt = new Date();
    };
    $scope.today();

    $scope.clear = function () {
        $scope.dt = null;
    };

    // Disable weekend selection
    $scope.disabled = function (date, mode) {
        return (mode === 'day' && (date.getDay() === 0 || date.getDay() === 6));
    };

    $scope.toggleMin = function () {
        $scope.minDate = $scope.minDate ? null : new Date();
    };
    $scope.toggleMin();

    $scope.open = function ($event) {
        $event.preventDefault();
        $event.stopPropagation();

        $scope.opened = true;
    };

    $scope.dateOptions = {
        formatYear: 'yy',
        startingDay: 1
    };

    $scope.formats = ['dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate'];
    $scope.format = $scope.formats[0];

    var tomorrow = new Date();
    tomorrow.setDate(tomorrow.getDate() + 1);
    var afterTomorrow = new Date();
    afterTomorrow.setDate(tomorrow.getDate() + 2);
    $scope.events =
            [
                {
                    date: tomorrow,
                    status: 'full'
                },
                {
                    date: afterTomorrow,
                    status: 'partially'
                }
            ];

    $scope.getDayClass = function (date, mode) {
        if (mode === 'day') {
            var dayToCheck = new Date(date).setHours(0, 0, 0, 0);

            for (var i = 0; i < $scope.events.length; i++) {
                var currentDay = new Date($scope.events[i].date).setHours(0, 0, 0, 0);

                if (dayToCheck === currentDay) {
                    return $scope.events[i].status;
                }
            }
        }

        return '';
    };
});
/* Styles go here */

<button ng-click="addChild()">add</button>
<button ng-click="remove()">Delete</button>
<select ng-model="valueSelected">
  <optgroup>
      <option value="LIKE">LIKE</option>
      <option value="BETWEEN">BETWEEN</option>
      <option value="EXISTS">EXISTS</option>
  </optgroup>
</select>
<div ng-switch on="valueSelected">
    <div ng-switch-when="LIKE"><input type="text" /></div>
    <div ng-switch-when="BETWEEN">
        <style>
            .full button span {
                background-color: limegreen;
                border-radius: 32px;
                color: black;
            }
            .partially button span {
                background-color: orange;
                border-radius: 32px;
                color: black;
            }
        </style>
        <div ng-controller="DatepickerDemoCtrl">
    
            <div class="row">
                <div class="col-md-6">
                    <p class="input-group">
                        <input type="text" class="form-control" datepicker-popup="{{format}}" ng-model="dt" is-open="opened" min-date="minDate" max-date="'2015-06-22'" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" ng-required="true" close-text="Close" />
                        <span class="input-group-btn">
                            <button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
                        </span>
                    </p>
                </div>
    
                <div class="col-md-6">
                    <p class="input-group">
                        <input type="date" class="form-control" datepicker-popup ng-model="dt" is-open="opened" min-date="minDate" max-date="'2015-06-22'" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" ng-required="true" close-text="Close" />
                        <span class="input-group-btn">
                            <button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
                        </span>
                    </p>
                </div>
            </div>
        </div>
        <div ng-switch-when="EXISTS">I show when EXISTS is selected</div>
        <div ng-switch-default>I show by default</div>
    </div>
</div>
<ul>
  <li ng-repeat="child in user.children">
    <drop-down user="child"></drop-down>
  </li>
</ul>