I've got several HTML files and I need to extract text content of given elements in these html files and get it into angular as variables.
I've decided to use angular $templateRequest
to get each HTML file, and $templateCache
to store them in cache. I was hoping this way I could use angular or jQuery/jQueryLite selector to access these cached templates and get a specific element contents by element ID. But when it comes to retrieving the a given element text from given cached template, I'm hitting the wall.
$templateRequest(htmlFileUrl.html).then(function(htmlFile) {
$templateCache.put(htmlFileName, htmlFile);
var template = $templateCache.get(name);
var elementId = '#some_id'; //element present in htmlFileUrl.html
var elementText;
// Assign text value of elementId to elementText SOMEHOW
console.log(elementText) // Should print text of elementId
});