I'm new to AngularJs, my problem is that when I clicked the button that I append it doesn't call the function or the function doesn't work.
HTML
</tbody>
<tr>
<td><input type="text" class="form-control" ng-model="contact.name"/></td>
<td><input type="text" class="form-control" ng-model="contact.email"/></td>
<td><input type="text" class="form-control" ng-model="contact.number"/></td>
<td colspan="2">
<button class="btn btn-primary btn-block" ng-click="addContact()">Add Contact</button>
</td>
</tr>
<tr ng-repeat="contact in contactlist">
<td>{{contact.name}}</td>
<td>{{contact.email}}</td>
<td>{{contact.number}}</td>
<td><button class="btn btn-danger" ng-click="removeContact(contact._id)"><i class="glyphicon glyphicon-trash"></i></button></td>
<td><button class="btn btn-info" ng-click="editContact(contact._id)"><i class="glyphicon glyphicon-pencil"></i></button></td>
</tr>
</tbody>
ANGULAR
$scope.editContact = function(id){
$http.get('/contactlist/' + id).success(function(response){
$scope.contact = response;
var addButton = angular.element('#custom_btn');
addButton.empty();
addButton.append('<button class="btn btn-success btn-block" ng-click="update()">Update Contact</buton>');
});
};
$scope.update = function(){
alert('test');
};
what is wrong with my code. my idea is that it is the same with jQuery.. where all elements appended by jquery will have a body
on its function call..
thanks in advance.