A unique situation arises with the controller in which data is fetched from a factory:
.controller('ChatDetailCtrl', function($scope, $stateParams, Messages) {
$scope.messages = Messages.get($stateParams.partnerId);
$scope.send = function (input) {
input.id = Math.random();
input.sent = true;
input.time = new Date();
$scope.messages.data.push(input);
console.log($scope.messages);
}
})
An NG-repeat is utilized to showcase the messages on the template. Additionally, there is an input that triggers send using NG-click. The issue lies when you send a message, it gets added to the array. However, if you continue typing, it updates the sent message rather than allowing you to send a new one.
The challenge here is how to pass the input to the array in a manner that allows repetition multiple times?