I'm currently trying to render an html from a method in the angle handler like this:
me.func1 = function (codDep) {
var str = '';
angular.element(document.querySelector('#ligas')).remove();
str += '<div id="ligas">';
for (i = 0; i < me.Model.Ligas.length; i++) {
var lig = me.Model.Ligas[i];
str += '<a href="#" id="' + lig.Id + '" class="list-group-item" data-ng-click="me.func2()">' + lig.Nombre + '</a>';
}
str += '</div>';
angular.element(document).find('#' + idElement).after(str);
};
The html is perfectly rendered up to data-ng of angulajs like this:
<a href="#" id="217" class="list-group-item" data-ng-click="me.func2()">Esto es un link</a>
.
The problem I have is that when I click on the previously created element, it does not execute the data-ng-click="me.func2 ()" that contains the following method:
me.func2 = function () {
alert('Funcion #2 ejecutada');
};
I'm new to the framework, I really do not know if this is possible (it should not be another thing), or I'm doing something wrong.
Thank you in advance for the help you can give me.