I'm fairly new to using AngularJS. I'm fine with loading data using AngularJS, but I'm having trouble with basic jQuery click events on the items I'm loading. Using the code below:
<div ng-repeat="x in data" class="element">
<span class="text">This is the text to grab</span>
</div>
$(document).ready(function(){
$('.element').on('click',function(){
var $text = $(this).find('.text').text();
alert($text);
});
});
This doesn't work so I'm curious if when iterating elements with AngularJS, if it doesn't actually append the DOM so when using this jQuery function, it doesn't actually see the element I'm clicking on. Your help is appreciated.
UPDATE: So, the "Element" div will repeat across the page x number of times. When I click on one of them, I want an alert to pop up with the content in that child of "Element". This isn't happening, so I'm curious about the "Element" class actually be appended to the DOM by AngularJS. Thanks!