角度材料列表随着ng-click而消失

时间:2017-04-03 17:53:31

标签: angularjs angular-material

有趣的问题。这是我的列表代码:

<md-list flex>  
    <md-list-item class="md-2-line" ng-repeat="device in devices" ng-init="deviceDtl = getDevice(device.$id); tonerCount = tonerCount(device.$id)" ng-click="clickEvent()" >
        <i class="md-avatar mdi mdi-print m-t-5" style="font-size:42px"></i>
        <div class="md-list-item-text">
            <h3>{{deviceDtl.Make}} {{deviceDtl.Model}}</h3>
            <span ng-show="device.create_date" am-time-ago="device.create_date|amFromUnix"></span>
            <span ng-hide="device.create_date">Added date not available</span>
        </div>
    </md-list-item>
</md-list> 

这就是它产生的东西:

enter image description here

如果我从ng-click="clickEvent()"移除md-list-item,那么它可以正常运行:

enter image description here

我在这里缺少什么?

1 个答案:

答案 0 :(得分:2)

愚蠢的错误,正在使用

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/angular-material/1.1.1/angular-material.min.css">

需要:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/angular-material/1.1.3/angular-material.min.css">