Difficulty in displaying data on the screen with angular

0

Good afternoon guys

I'm making an app, where, when entering text, the message should appear on the screen. But something strange happens, only the cards (where the text should be displayed) is that it appears and empty! Without the text.

HTML:

ion-view title="Chat" hide-back-button="false">
<ion-content overflow-scroll="true" padding="true" class="has-header">

    <div ng-repeat="mensagem in mensagens">
       {{mensagem.nome}}
       {{mensagem.msg}}
       {{mensagem.hora}}
    </div>

</ion-content>

<form name="chatForm">
 <ion-footer-bar class="bar-stable item-input-inset">
 <!--<button class="button button-clear button-positive button-icon button-camera ion-camera" ng-click="addMedia()"></button>-->
  <label class="item-input-wrapper">
    <input type="text" ng-focus="inputUp()" ng-blur="inputDown()" name="chat" ng-model="mensagem.chat" placeholder="Texto" ng-required="true" ng-disabled="disableButtonChat"/>
  </label>
  <!--<button class="button-mic ion-ios-mic"></button>-->
  <button class="button button-clear button-positive" ng-disabled="chatForm.chat.$invalid || disableButtonChat" ng-click="enviarMsgChat(mensagem)">Enviar</button>

  </ion-footer-bar>
</form>

Controller:

.controller('chatCtrl', function($scope, $http, $window, $ionicScrollDelegate) {
$scope.mensagens = [];
$scope.mensagem = {
  chat: ""
}

$scope.enviarMsgChat = function (mensagem) {
    var msg = mensagem.chat;

    $scope.disableButtonChat = true;

    var dia = moment().format(); //2016-02-16 T 16:05:52-02:00
    var diaP = dia.split('T');
    var dia = diaP[0];

    var horaP = diaP[1];
    var horaP2 = horaP.split(':');
    var hora = horaP2[0]+':'+horaP2[1];

    var idUsuario = $window.localStorage.getItem('idUsuario');
    var nome = $window.localStorage.getItem('nome');
    var usuario = $window.localStorage.getItem('usuario');
    var logradouro = $window.localStorage.getItem('logradouro');

    var msgChat = {
        idUsuario: idUsuario,
        nome: nome,
        usuario: usuario,
        logradouro: logradouro,
        mensagem: msg,
        dia: dia,
        hora: hora
    }

    $scope.mensagens.push({usuario:usuario, mensagem:msg, hora:hora})

}

})
    
asked by anonymous 25.05.2016 / 22:04

0 answers