A
A
Anton2015-07-06 15:00:36
Angular
Anton, 2015-07-06 15:00:36

How to change data in Angular from view?

Given: A note-taking app. There is a form in which the user enters data. This data is passed to the object, the object is written to the array in $scope. Further, this data is displayed in the view. For each note there is a "Move to Archive" button. When this button is pressed, the object to which the button corresponds must be transferred to another array.
Question: how to associate a specific object with the transfer to archive button. In other words, how to make it so that when you click on the transfer to the archive of note A, Angular selects exactly the object we need and transfers it to another array?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Tartmin, 2015-07-06
@baskerville42

Well, write a function that will create a new array and transfer all elements into it one by one. This can be done via map or via the angular.forEach() method.
PS: In Angular, data changes in the view anyway, MVVM framework, as it were;)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question