在AngularJS中滚动底部聊天

时间:2018-01-23 15:41:59

标签: javascript jquery html angularjs scroll

当我打开ng-show聊天窗口时,我正在尝试滚动div的结尾,但它只适用于第二次点击。我已经在很多方面尝试了它,但我没有让它在第一次点击工作。

HTML CHAT:

   ERROR Error: StaticInjectorError[NgbDropdownConfig]: 
  StaticInjectorError[NgbDropdownConfig]: 
    NullInjectorError: No provider for NgbDropdownConfig!
    at _NullInjector.get (core.js:993)
    at resolveToken (core.js:1281)
    at tryResolveToken (core.js:1223)
    at StaticInjector.get (core.js:1094)
    at resolveToken (core.js:1281)
    at tryResolveToken (core.js:1223)
    at StaticInjector.get (core.js:1094)
    at resolveNgModuleDep (core.js:10878)
    at NgModuleRef_.get (core.js:12110)
    at resolveDep (core.js:12608)

控制器功能:

<div class="chat">
    <div class="" ng-show="chatdis">
        <div class="chat-header vertical-center clearfix">
           <img ng-src="user/pix.php/{{ctrl.idchat}}/f1.jpg" class="imgperfil img-circle" alt="avatar" ng-class="{'online': ctrl.useronline, 'offline': !ctrl.useronline}"/>
           <div class="chat-about">
               <div class="chat-with">{{ctrl.namechat}}</div>
           </div>
           <div class="close pull-right" style="opacity: 0.6;" ng-click="ctrl.fecharconversa()">
               <i class="fa fa-times" aria-hidden="true" style="display: block;font-size: 16px;position: absolute;top: 6px;right: 8px;color: #797979;"></i>
           </div>
        </div> <!-- end chat-header -->

        <div class="chat-history">
           <ul style="margin: 0;padding: 0;">
              <li ng-id="message-{{obj.id}}" class="clearfix" ng-repeat="obj in ctrl.mensagens | orderBy:'-'">
                 <div class="message" ng-class="{'other-message': obj.useridto == <?php echo $USER->id ?>, 'my-message float-right': obj.useridto != <?php echo $USER->id ?>}">
                    <p ng-bind-html="obj.smallmessage"></p>
                    <span class="tail-container"></span>
                    <span class="tail-container highlight"></span>
                 </div>

                 <div class="message-data" ng-class="{'align-right': obj.useridto != <?php echo $USER->id ?>}">
                    <span class="message-data-time" ng-class="{'text-right': obj.useridto != <?php echo $USER->id ?>}" ng-if="obj.useridto != <?php echo $USER->id ?>">
                       {{obj.firstname}} {{obj.lastname}} - {{obj.timecreated | date:"dd/MM/yyyy HH:mm"}}
                    </span>
                    <span class="message-data-time" ng-if="obj.useridto == <?php echo $USER->id ?>">
                       {{obj.timecreated | date:"dd/MM/yyyy HH:mm"}} - {{obj.firstname}} {{obj.lastname}}
                    </span>
                 </div>
              </li>
           </ul>
        </div> <!-- end chat-history -->

        <div class="chat-message clearfix">
            <textarea name="message-to-send" ng-model="message" id="message-to-send" placeholder ="Escreva sua mensagem" rows="2"></textarea>
            <button ng-click="ctrl.inseremensagem(ctrl.idchat, message, ctrl.namechat, ctrl.useronline)">Enviar</button>
        </div> <!-- end chat-message -->
     </div>
  </div> <!-- end chat -->

控制器功能,当我点击侧边菜单中的人员列表时,我会调用它。有人能帮我吗? :d

0 个答案:

没有答案