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 @@
</ul>
</div>
<div ng-controller="chatController as chatList">
<div ng-controller="ChatController as chatController">
<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-right" ng-if="chat.from === 'me'">{{chat.text}}</p>
</div>
</div>
<div class="chat-box">
<form class="form-chat-box" ng-submit="chatList.addChat()">
<input class="text-input" ng-model="chatList.chatText"
<form class="form-chat-box" ng-submit="addChat()">
<input class="text-input" ng-model="chatText"
placeholder="Enter a message">
<input class="send-button" type="submit" value="Kirim">
</form>
......@@ -67,19 +67,18 @@
</script>
<script>
angular.module('chatApp', [])
.controller('chatController', function () {
var chatList = this;
chatList.chats = [];
.controller('ChatController', function ($scope) {
$scope.chatList = [];
chatList.addChat = function () {
if (chatList.chatText.length !== 0) {
chatList.chats.push({
$scope.addChat = function () {
if ($scope.chatText.length !== 0) {
$scope.chatList.push({
from: 'me',
text: chatList.chatText
text: this.chatText
});
}
chatList.chatText = '';
$scope.chatText = '';
};
});
</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