Skip to content
Snippets Groups Projects
Commit 7c8ea7cf authored by Irene Edria Devina's avatar Irene Edria Devina
Browse files

Merge branch 'dev-chat-driver' of...

Merge branch 'dev-chat-driver' of http://gitlab.informatika.org/IF3110-2017-K02-AMEN/TugasBesar3_2017 into dev-chat-driver
parents 2ae51c2f b518a4e3
Branches
No related merge requests found
...@@ -32,16 +32,16 @@ ...@@ -32,16 +32,16 @@
</ul> </ul>
</div> </div>
<div ng-controller="chatController as chatList"> <div ng-controller="ChatController as chatController">
<div id="scrollArea"> <div id="scrollArea">
<div ng-repeat="chat in chatList.chats"> <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>
<p class="chat-bubble-right" ng-if="chat.from === 'me'">{{chat.text}}</p> <p class="chat-bubble-right" ng-if="chat.from === 'me'">{{chat.text}}</p>
</div> </div>
</div> </div>
<div class="chat-box"> <div class="chat-box">
<form class="form-chat-box" ng-submit="chatList.addChat()"> <form class="form-chat-box" ng-submit="addChat()">
<input class="text-input" ng-model="chatList.chatText" <input class="text-input" ng-model="chatText"
placeholder="Enter a message"> placeholder="Enter a message">
<input class="send-button" type="submit" value="Kirim"> <input class="send-button" type="submit" value="Kirim">
</form> </form>
...@@ -67,19 +67,18 @@ ...@@ -67,19 +67,18 @@
</script> </script>
<script> <script>
angular.module('chatApp', []) angular.module('chatApp', [])
.controller('chatController', function () { .controller('ChatController', function ($scope) {
var chatList = this; $scope.chatList = [];
chatList.chats = [];
chatList.addChat = function () { $scope.addChat = function () {
if (chatList.chatText.length !== 0) { if ($scope.chatText.length !== 0) {
chatList.chats.push({ $scope.chatList.push({
from: 'me', from: 'me',
text: chatList.chatText text: this.chatText
}); });
} }
chatList.chatText = ''; $scope.chatText = '';
}; };
}); });
</script> </script>
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