In my AEM component, there is an rte element.
all the markup is generated dynamically and I wanted to append an ng-click to call a function.
Here is the code for adding RTE${properties.text @context='html'}
This is giving me just a class that i am using as selector.
My existing code is as follows :
var sdshopNowLink = angular.element('.sdshopNowLink');
sdshopNowLink.on('click', function(){
$scope.submitshopeCatalog();
});
I was using javascript selectors first but that is not working for the first time. Using $compile is working locally but not after minification.
var sdshopNowLink = angular.element('.sdshopNowLink');
sdshopNowLink.attr("ng-click", "submitshopeCatalog()");
compile(sdshopNowLink);
function compile(element){
var el = angular.element(element);
$scope = el.scope();
$injector = el.injector();
$injector.invoke(function($compile){
$compile(el)($scope)
});
}
Also the above has some perf issues as well. Is there any other way i can append ng-click & call the function.