add objectives

ul select and search

by Hugo Licon

HTML

<div ng-app="app">
  <div ng-controller="search">

    <p align="left">Search:
      <input ng-model="query[queryBy]" />
    </p>

    </li>
    <pre>{{selection | json}}</pre>
    <pre>{{selectedIds | json}}</pre>
  </div>

CSS

.selected {
  background-color: yellow;
  color: blue;
}

li {
  list-style: none;
}

ul {
  position: 0;
  margin: 0;
}

a {
  color: gray;
  text-decoration: none;
  cursor: pointer;
}

body {
  font-family: 'Helvetica', sans-serif;
}

JavaScript

var app = angular.module('app', []);

app.controller("search", function($scope) {
  $scope.selection = [];
  $scope.toggle = function(idx) {
    var pos = $scope.selection.indexOf(idx);
    if (pos == -1) {
      $scope.selection.push(idx);
    } else {
      $scope.selection.splice(pos, 1);
    }
  };

  $scope.query = {}
  $scope.queryBy = 'name'
  $scope.employees = [{
    "name": "Juan Perez",
    "id": 1
  }, {
    "name": "Luis Flores",
    "id": 2
  }, {
    "name": "Pedro Jimenez",
    "id": 3
  }, {
    "name": "Adrian Gonzalez",
    "id": 4
  }, {
    "name": "Luis Perez",
    "id": 5
  }];
});