Skip to content
Snippets Groups Projects
Commit ba8b1cad authored by Devin Alvaro's avatar Devin Alvaro
Browse files

Merge branch 'dev-username-id' of...

Merge branch 'dev-username-id' of http://gitlab.informatika.org/IF3110-2017-K02-AMEN/TugasBesar3_2017
parents c5f61e61 47211816
Branches
No related merge requests found
...@@ -75,6 +75,20 @@ ...@@ -75,6 +75,20 @@
$scope.chatList = [] $scope.chatList = []
// Scroll to bottom.
let scrollToBottom = function () {
let area = document.querySelector('#scrollArea')
area.scroll({top: area.scrollHeight, behavior: 'smooth'})
}
scrollToBottom()
$scope.$watchCollection('chatList', function (newValue) {
if (newValue) {
$timeout(scrollToBottom, 100)
}
})
// Initialize Firebase. // Initialize Firebase.
account.initAsync() account.initAsync()
.then(function (chats) { .then(function (chats) {
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<h2>${pickerId}</h2> <h2>${pickerId}</h2>
</div> </div>
</div> </div>
<div ng-controller="ChatController"> <div ng-controller="ChatController" ng-scroll-bottom="chatList">
<div id="scrollArea"> <div id="scrollArea">
<div ng-repeat="chat in chatList"> <div ng-repeat="chat in chatList">
<p class="chat-bubble-left" ng-if="chat.from === 'them'">{{chat.text}}</p> <p class="chat-bubble-left" ng-if="chat.from === 'them'">{{chat.text}}</p>
...@@ -54,6 +54,20 @@ ...@@ -54,6 +54,20 @@
$scope.chatList = [] $scope.chatList = []
// Scroll to bottom.
let scrollToBottom = function () {
let area = document.querySelector('#scrollArea')
area.scroll({top: area.scrollHeight, behavior: 'smooth'})
}
scrollToBottom()
$scope.$watchCollection('chatList', function (newValue) {
if (newValue) {
$timeout(scrollToBottom, 100)
}
})
// Initialize Firebase. // Initialize Firebase.
account.initAsync() account.initAsync()
.then(function (chats) { .then(function (chats) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment