Witam,
znacie lepszą metodę na wybranie elementów nie pasujących do listy (notContains)?
Array.prototype.notContains = function (obj) {
var i = this.length
while (i--) {
if (this[i] === obj) return false
}
return true
}
function loadData () {
$http.get('test-data/time-sheet-employees.json')
.then(function (res) {
self.timeSheetEmployees = res.data
var employeeIds = self.timeSheetEmployees.map(function (x) { return x.id })
var otherEmployees = $.grep($rootScope.data.employees, function (x) {
return employeeIds.notContains(x.id)
})
angular.forEach(otherEmployees, function (employee) {
self.otherEmployees.push(new Employee(employee.id, String.format('{0} {1}', employee.last_name, employee.first_name)))
})
})
}
M.