T
T
Tatarin2015-02-23 00:58:34
Angular
Tatarin, 2015-02-23 00:58:34

Add\remove\change data events in angularjs collections?

Is there any way to keep track of adding, deleting, changing data in an array of models in angularjs, as it is implemented, for example, in backbonejs collections?
something from the category (the code is invalid, I'm more to explain what I need)

$scope.$watch('collection_expression_on_delete', function (delete_item) {
    });

it's just $watch if it watches the collection, then it gives new and old values ​​to the callback and in order to understand which element was deleted, I have to compare them - it seems to me that in such a large frame there should be a beautiful way for such a trivial task

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Shvalyov, 2015-02-23
@dshster

$watchCollection is in 1.1.4, focused on tracking collections

D
Dmitry Dedukhin, 2015-02-23
@Demetros

There are no built-in tools for what you want.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question