angular-ui >ui-utils >ui-scroll 不起作用 (v. 0.1.0) [英] angular-ui > ui-utils > ui-scroll does not work (v. 0.1.0)

查看:32
本文介绍了angular-ui >ui-utils >ui-scroll 不起作用 (v. 0.1.0)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用这个:http://angular-ui.github.io/ui-utils/ 更具体地说:https://github.com/angular-ui/ui-utils/blob/master/modules/scroll/README.md

但是它似乎不起作用.下面是一个例子:

<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 class="time">{{聊天时间}}

<div ng-class="$index % 2 == 0? 'chat-message-body on-left' : 'chat-message-body'"><span class="箭头"></span><div class="sender"><a href="#">{{chat.name}}</a></div><div class="text">{{chat.msg}}

但是我在 HTML 中得到的只是这个:

<div class="chat-messages" style="height:240px;"ng-scroll-viewport=""><!--ngScroll:在聊天中聊天-->

如果我用 ng-repeat 替换 ng-scroll,它会完美运行.但是聊天需要滚动条,所以......我怎样才能得到一个?:)

解决方案

获得滚动的一种方式是使用 CSS,设置 overflow-y 为滚动,您将获得滚动条.

如果需要滚动到底部,使用anchorScrollhttp://docs.angularjs.org/api/ng.$anchorScroll.

I am using this: http://angular-ui.github.io/ui-utils/ and to be more specific this:https://github.com/angular-ui/ui-utils/blob/master/modules/scroll/README.md

however it does not seem to work. Here is an example:

<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>

But All I get in HTML is this :

<div class="chat">

    <div class="chat-messages" style="height:240px;" ng-scroll-viewport="">
        <!--

         ngScroll: chat in chats 

        -->
    </div>

If I replace ng-scroll with ng-repeat, it works perfectly. But chats need scroll bars, so... How can I get one? :)

解决方案

One way of getting a scroll is to use CSS, set overflow-y to scroll and you will get scroll bar.

If you need to scroll to the bottom, play with anchorScroll http://docs.angularjs.org/api/ng.$anchorScroll.

这篇关于angular-ui &gt;ui-utils &gt;ui-scroll 不起作用 (v. 0.1.0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
前端开发最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆