Answer the question
In order to leave comments, you need to log in
How to properly change the model in AngularJS?
There is the following working shit code (I can’t name it otherwise, because I’m still just learning).
'use strict';
angular.module('dumpsterApp.controllers', []).
controller('AppCtrl', function ($scope, socket) {
$scope.tl = 20;
$scope.news = [];
socket.on('news', function (data) {
$scope.news.push(data); // засовываем данные
if ($scope.news.length > $scope.tl) {
$scope.news = $scope.news.slice(-$scope.tl); // а теперь удаляем
}
});
})
Answer the question
In order to leave comments, you need to log in
You are wrong, dom is updated once.
If your table changes so often, then I assume that your question is due to the fact that you encountered some kind of brakes?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question