我正在使用这个:http ://angular-ui.github.io/ui-utils/ ,更具体地说:https ://github.com/angular-ui/ui-utils/blob/master/modules/滚动/README.md
但是它似乎不起作用。这是一个例子:
<div ng-scroll-viewport style="height:240px;" class="chat-messages">
<div class="chat-message" ng-scroll="chat in chats">
<div ng-class="$index % 2 == 0? 'sender pull-right' : 'sender pull-left'">
<div class="icon">
<img src="{{chat.img}}" class="img-circle" alt="">
</div>
<div class="time">
{{chat.time}}
</div>
</div>
<div ng-class="$index % 2 == 0? 'chat-message-body on-left' : 'chat-message-body'">
<span class="arrow"></span>
<div class="sender"><a href="#">{{chat.name}}</a></div>
<div class="text">
{{chat.msg}}
</div>
</div>
</div>
</div>
但我在 HTML 中得到的只是:
<div class="chat">
<div class="chat-messages" style="height:240px;" ng-scroll-viewport="">
<!--
ngScroll: chat in chats
-->
</div>
如果我用 ng-repeat 替换 ng-scroll,它会完美运行。但是聊天需要滚动条,所以...我怎样才能得到一个?:)