从md-list-item(AngularJS材料)中删除点击行为

时间:2018-06-26 12:07:04

标签: css angularjs angular-material material-design

在AngularJS材质中,我想要一个简单的列表,而不是可单击的项,只是具有正确间距的文本。我无法列出不可点击的列表!

我查看了文档,但我不明白为什么总是添加class =“ md-clickable” ...这是我的代码:

https://codepen.io/anon/pen/zaJpGY

public function serializeTransactions()
{
    $xml = simplexml_load_file("/var/www/html/web/uploads/gps-trans.xml");

    $response = json_decode(json_encode((array)$xml), true);

    foreach ($xml as $result) {
        $result = (array)$result;
        $gps = new Transactions();
        $gps->setType();
        $gps->setData(json_encode($result));

        $this->em->persist($gps);
    };

    $this->em->flush();
}

如何使这些列表项不可点击?

2 个答案:

答案 0 :(得分:2)

一种解决方案是禁用您的list-item

<md-content class="acc-content">
      <md-list>
          <md-list-item ng-disabled="true"> <!-- here -->
            <md-checkbox ng-disabled="true" ng-checked="true"></md-checkbox>
            <p class="md-list-item-text">Agree to terms and conditions</p>
          </md-list-item>
          <md-list-item>
            <md-checkbox></md-checkbox><p>Provide personal details</p>
          </md-list-item>
          <md-list-item>
            <md-checkbox></md-checkbox><p>Bank details</p>
          </md-list-item>
      </md-list>
</md-content>

答案 1 :(得分:0)

您可以将 class="md-no-proxy" 添加到您的 md-list-item 标签

https://material.angularjs.org/latest/api/directive/mdListItem

<md-content class="acc-content">
      <md-list>
          <md-list-item class="md-no-proxy"> <!-- here -->
            <md-checkbox ng-disabled="true" ng-checked="true"></md-checkbox>
            <p class="md-list-item-text">Agree to terms and conditions</p>
          </md-list-item>
          <md-list-item>
            <md-checkbox></md-checkbox><p>Provide personal details</p>
          </md-list-item>
          <md-list-item>
            <md-checkbox></md-checkbox><p>Bank details</p>
          </md-list-item>
      </md-list>
</md-content>