Is it possible to create a table from md-list and md-list-item?

I do not want to use angular -material-data-table for this, since this is a different library.

The following does not work:

<md-list>
  <md-list-item class="md-2-line" ng-repeat="item in todos">
     <div class="md-list-item-text" layout="row">
       <div layout="column">{{item.title}}</div>
       <div layout="column">{{item.description}}</p=div>
     </div>
  </md-list-item>
</md-list>
+4
source share
2 answers

You can simply use the attribute layout-alignwith the element spanto get the desired result.

Here is the code.

<md-list style="background-color:red">
  <md-list-item class="md-2-line">
    <div class="md-list-item-text" layout="row" layout-align="start center">
      <span flex="10">Title</span>
      <span flex="5"></span>
      <span flex="30">Dessciption</span>
    </div>
  </md-list-item>
  <md-list-item class="md-2-line" ng-repeat="item in todos">
    <div class="md-list-item-text" layout="row" layout-align="start center">
      <span flex="10">{{item.title}}</span>
      <span flex="5"></span>
      <span flex="30">{{item.description}}</span>
    </div>
  </md-list-item>
</md-list>

Working example. http://codepen.io/next1/pen/oLWpPG

+6
source

A possible alternative based on the radio group to select the line.

<md-radio-group>
  <div ng-repeat="" class="row">
    <div flex="" layout="row" layout-padding="" layout-align="start enter">
      <md-radio-button flex="" class="md-primary">
      </md-radio-button>
      <div flex></div>
      <div flex></div>
    </div>
  </div>
</md-radio-group>

Working example: http://codepen.io/LouisJS/pen/pbwOVB

0
source

All Articles