Gustavo Gabriel Gustavo Gabriel - 2 months ago 8
AngularJS Question

Split an object properties in two columns

I wanna split an object properties in two columns, when I was using bootstrap I was able to do it with the clearfix class like so:

<div class="clearfix" ng-if="$index % 12 == 0"></div>


But now I am using angular material and I wanna know how do it. Below fiddle for testing and better explanation:

https://jsfiddle.net/twizzlers/234nLone/1/

<div layout="column">
<span ng-repeat="(key,value) in obj">
{{key}} : {{value}}
</span>
</div>


Appreciate any help.

Answer

following will do what you want

<div layout="row" layout-wrap>
  <span flex=50 ng-repeat="(key,value) in obj">
    {{key}} : {{value}}
  </span>
</div>

Always add flex to children of layout. Getting used to the layout rules/config takes a bit of time

DEMO