Is there a way in AngularJS to search the DOM for text after a new view is loaded? The filter almost does this, but I'm not interested in returning a new array of elements. For instance;
html
<div ng-view="">
<ul>
<li>Milk</li>
<li>Eggs</li>
<li>Cheese</li>
</ul>
</div>
js
$(document).ready(function() {
var app = angular.module('app', ['ngRoute'])
.config(['$routeProvider', function($routeProvider){
$routeProvider
.when('/', { templateUrl: 'example.html' })
}]);
app.controller('rttController', function($scope, $location) {
$scope.$on('$locationChangeSuccess', function(event) {
// Search through the DOM for text returned in this view
});
});
My ultimate objective is to create an array of specific keywords to search for in the DOM:
var foods[] = {"yogurt", "butter", "margarine"}
.
Any suggestions?