People with problem when I enter a HTML
that contains a ng
module, and when I click to execute nothing happens. See the Code:
//HomeCtrl.js
module.exports = function($scope) {
// Create Note
$scope.create = function(e) {
var value = $scope.inputNote,
$element = $(e.target).closest('.task-container').find('.tasks-list');
$element.prepend(
' <li class="task-item"> '
+ '<div class="task-check">'
+ '<label>'
+ '<input type="checkbox">'
+ '<span class="text"></span>'
+ '</label>'
+ '</div>'
+ '<div class="task-state">'
+ '<span class="label label-orange">ATIVA</span>'
+ '</div>'
+ '<div class="task-time">'
+ '<a class="btn btn-sm btn-danger" href="#!" ng-click="remove($event)"><i class="fa fa-trash"></i> Remover</a>'
+ '</div>'
+ '<div class="task-body">'+ value +'</div>'
+ '</li>'
);
};
// Button Remove
$scope.remove = function(e) {
var $element = $(e.target).closest('li');
$element.remove();
};
};
When I type in a input
and an ENTER, it sends to ng-submit="create($event)"
and executing the insertion of HTML
, the problem is button
that has the ng-click="remove($event)"
function and does not execute.