I have lots of code written in jQuery. Now I want an approach,Thousand lines of jQuery code is written, so I think it's better to achieve new functionalities using AngularJS. What basically I need is:
I have following code in app.js:
var cmsApp = angular.module('cmsApp', []);
cmsApp.controller('OOJRecordTab',['$scope' ,function($scope, $compile) {
$scope.test = function() {
console.log('Test');
};
}]);
HTML:
<ul>
<li class="dropdown open">
<a>Records <span>0</span></a>
<ul id="oojRecordsLinks" class="dropdown-menu">
<li>
<a ng-click="test()" tabindex="-1">test</a>
</li>
</ul>
</li>
</ul>
The above click function works perfectly. Now I have a function in jQuery like:
function addNewRecords(html){
$record = "<a ng-click='test()'></a>";
$("ul#oojRecordsLinks").append($record);
}
Click function for this newly appended row doesn't work. Please suggests. Someone help me please. It's not working till now.