S
S
someserj2017-01-03 20:25:35
JavaScript
someserj, 2017-01-03 20:25:35

How to remove an entry from an Angular.js array?

I have JSON data, I use Firebase + angularfire
84fcf7dc6b564f8896ac9682a9c8bddb.png
in the interface, it looks like this
59b67008c87749d585c7dd702f285e49.png

<li ng-repeat="item in vm.program">
    <div>{{item.$id}}</div>  <!-- выведет Monday -->
    <div>
        <div ng-repeat="item in vm.program[$index]">
            <div>{{item.name}}</div>
            <input type="text" ng-value="item.sets">
            <input type="text" ng-value="item.repeats">
            
            <button ng-click="vm.program[$index].$remove(item)" >Delete exercise</button>
        </div>
    </div>
</li>

The task is to delete the Exercise from the Day of the week by clicking on the button, it does not work now.
how to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Coder321, 2017-01-04
@Coder321

And what's the problem then? Pass on click the index of the element to the handler function and do slice(i, 1)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question