This Select box was doing what it was supposed to do but for some reason 
its not working anymore. The select box is displaying Employees that are 
project managers. When I select one it updates the input box with it. 

Filter

app.filter('filterEmployees', function() {
 return function (input) {
console.log('input: ', input);
var output = [];
if (!input instanceof Array) {
  console.log('error');
  return output;
  }
  // for all TESPM's
   input.forEach(function (tespm) {
  var employees = tespm.Employees; 
  if (!employees instanceof Array) {
    console.log('error');
    return output;
  }
  // for all employees
  employees.forEach(function (employee) {
    // filter
    if (employee.EmployeeIsPM) {
      output.push(employee.EmployeeFirstName + ' ' + employee.EmployeeLastName);
    }
  });
});
console.log('output: ', output);
return output;
   };
});


View

<div class="input-group">
   <span class="input-group-addon">J. TESPM</span>
   <input style="width:150px" ng-model="TESPM" class="form-control" type="text">
   <span class="input-group-addon">J. TESPM</span>
    <select class="form-control" ng-options="empl for empl in 
jobArray|filterEmployees" ng-model="TESPM">
          <option value="" disabled>Select</option>
    </select>
 </div>

 

Console Error Message

  {TypeError: undefined is not a function
   at g.<anonymous> (http://localhost:44301/MyScripts/app.js:215:15)
   at e (http://localhost:44301/Scripts/angular.min.js:155:305)
   at Ia.| (http://localhost:44301/Scripts/angular.min.js:143:226)
   at u.constant (http://localhost:44301/Scripts/angular.min.js:154:182)
   at h [as $render] (http://localhost:44301/Scripts/angular.min.js:190:25)
   at Object.<anonymous> (http://localhost:44301/Scripts/angular.min.js:172:335)
   at g.$digest (http://localhost:44301/Scripts/angular.min.js:98:177)
   at g.$apply (http://localhost:44301/Scripts/angular.min.js:101:12)
   at http://localhost:44301/Scripts/angular.min.js:17:415
   at Object.d [as invoke] 
(http://localhost:44301/Scripts/angular.min.js:30:328)
 {input:  
  [Object, Object, Object, Object, Object, Object, Object, Object, Object, 
Object, Object,     Object, Object, Object, Object, Object, Object, Object, 
Object, Object]
output:  [] 
  input:  Object {} 


Line 215 in the filter is

// for all TESPM's
input.forEach(function (tespm) {



-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to