I am using a controller like this
app.controller('EmployeeCrtl', ['$http', '$scope', function($http, $scope) {
$http.get('/Data/EmployeeDetails.json').success(function(data) {
$scope.EmployeeData = data;
}).error(function() {
alert('error');
});
//check employee details value
$scope.insertEmployeeDetails = function(emp) {
debugger;
if (emp.EmployeeName !== '' && emp.Designation !== '' && emp.Email !== '' && emp.Address !== '' && emp.PhoneNumber !== '') {
if (emp.EmployeeName !== undefined && emp.Designation !== undefined && emp.Email !== undefined && emp.Address !== undefined && emp.PhoneNumber !== undefined) {
debugger;
$scope.EmployeeData.push(emp);
this.emp = {};
}
}
}
}]);
and i have a directive like this
app.directive('addEmployee', function() {
return {
restrict: 'A',
templateUrl: '/Template/AddEmployee.html',
link: function(scope, elem, attr, ctrl) {
debugger;
},
controller: 'EmployeeCrtl',
scope: {
insertEmployeeDetails: "&",
EmployeeData: "="
}
};
});
Now what i am trying to do is, when i call the insertEmployeeDetails function i push the EmployeeData with the new data, but in this i get an error like this console error can anyone help me on how to remove this error, i actually want the data which is added in the EmployeeData property to be bound in the table which i use