I am trying to change a text to input['type="text"] element with a button appended for updating it. However, when i attach a function($scope.commit_update) on its ng-click event,the function is not firing.
$scope.commit_update = function(id){
console.log(id);
}
$scope.update = function($service_id){
var current_text = document.getElementById($service_id).innerHTML;
if(/<[a-z][\s\S]*>/i.test(current_text) == false){
var vars = $service_id.split('-');
var node = '<div class="input-group" style="width:200px;"><span class="input-group-addon" style="cursor:pointer;" ng-click="commit_update('+vars[1]+')">Save</span><input type="text" class="form-control" value="'+current_text+'" style="width:200px;"></div>';
document.getElementById($service_id).innerHTML = node;
}
}