Answer the question
In order to leave comments, you need to log in
Angularjs. How to remove variables from scope and still leave layout?
Greetings.
Let's say we have a chat in Angular.
Messages are stored in the $scope.messages array. Let the maximum size of this array be 100 messages. Is it possible to replace the old messages in the array with the new ones so that users can see the old messages as well. That is, old messages should not be removed from the DOM.
Answer the question
In order to leave comments, you need to log in
Yes, you can write your own directive that implements this behavior. Another question is why? Usually the problem is not the number of array elements, but the number of DOM elements.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question