Answer the question
In order to leave comments, you need to log in
Function does not work when clicking on an element with the ng-click attribute?
The essence of the question is as follows:
there is such an html code: <span ng-click="childComment()">Comment 1</span>
and something like this javascript code:
var commentsApp = angular.module('commentsApp', []);
commentsApp.controller("commentsController", function ($scope, $http, $timeout) {
$scope.childComment = function () {
console.log('Ok');
};
$timeout(function () {
var span2 = angular.element('<span>')
.attr('ng-click', 'childComment()').text('Comment 2');
}, 1000);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question