Here is the JSON schema I am working with. My goal is to display links within each object's description in my application:
{
"notes": {
"long random ID number 1": [
{
"name": "test 1",
"description": "<a href='http://google.com'>google</a>"
}
],
"long random ID number 2": [
//more objects with names and descriptions
]
}
}
Within the 'notes' structure, there are multiple arrays of JavaScript objects each with a unique key format. How can I programmatically iterate over these arrays regardless of their keys, then utilize Angular's $sce.trustAsHtml()
function on the link contained within each object's description for proper UI rendering?
Edit:
var notesKeys = Object.keys($scope.requirements.notes);
for(var key in notesKeys)
{
for(var note in $scope.requirements.notes[key])
{
$sce.trustAsHtml(note.description);
$sce.trustAsHtml(note.name);
console.log(note.description);
console.log(note.name);
}
}