Say in my controller somewhere I have:
$scope.elements = [document.getElementById('a'), document.getElementById('b')];
and I have valid elements somewhere in the document with IDs of a and b.
I'd like to interpolate these elements directly in an HTML template, without writing JavaScript. I tried the following, and it did not work.
<div ng-repeat="e in elements">
{{ e }}
</div>
Is this possible?
More information about what I'm doing:
I have content (several custom directive elements which load up their own data via AJAX) that I want to disperse between several columns. The column of the content elements will change, and the number of columns will change.
<column-resizer options="columnResizerOptions">
<content1></content1>
<content2></content2>
...
</column-resizer>
The template for columnResizer currently looks like this:
<ng-transclude></ng-transclude>
<div ng-repeat="column in columns">
<div ng-repeat="element in column">
{{ element }}
</div>
</div>
columnResizerOptions is information about how to resize the columns and where to place the content in the columns. In the link function for the columnResizer, I use transclude to grab content1-contentn and place them in arrays corresponding to the column they should be in, which I ngRepeat through in my template (above).
document.getElementById(), you are trying to program against the DOM. Angular doesn't need to be developed in this manner. How did the HTML content get into those elements without angular knowing about it, or being able to be told by the server when the page was rendered? Something isn't adding up here.ng-repeaton the data, instead of the rendered HTML? As it stands right now, this is definitely an XY Question. see meta.stackexchange.com/questions/66377/what-is-the-xy-problem/…link()with thetransclude()function and disperse into a set of arrays, and I'd like each array to display in a differentng-repeateddiv. I'll update the original question with this information.