0

I'm using ng-repeat to generate a couple inline-block elements.

The catch is I need comments to fill the gap between each repeated block.

Why do I need that? It's a hack to remove spacing between inline-block elements:
http://css-tricks.com/fighting-the-space-between-inline-block-elements/

My Desired Output:

<div>
    <div>One</div><!--
    --><div>Two</div><!--
    --><div>Three</div>
</div>

If I use ng-repeat in the traditional sense:

<div>
    <div ng-repeat="item in items" ng-bind="item"></div>
</div>

Outputs like this:

<div>
    <!-- ngRepeat: item in items -->
    <div ng-repeat="item in items" ng-bind="item">One</div>
    <!-- end ngRepeat: item in items -->
    <div ng-repeat="item in items" ng-bind="item">Two</div>
    <!-- end ngRepeat: item in items -->
    <div ng-repeat="item in items" ng-bind="item">Three</div>
    <!-- end ngRepeat: item in items -->
</div>

How can I get it to include trailing comments like shown in My Desired Output?

||||||
  • 1
    It naturally does that anyways... are you viewing the output through inspect? Because through inspect, everything gets rearranged. – Yang Li Dec 30 '14 at 1:01
  • I see, thanks @YangLi – Nick Carson Dec 30 '14 at 5:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.