I'm trying to remove an element inside ngRepeat
. It's removing well, but after the element is removed, the page is reloaded. How can I prevent this reload action?
Heres the code:
<li ng-repeat="task in tasks">
<p>{{task.title}}</p>
<button ng-click="remove($index)">Click me</button>
</li>
js scope:
$scope.remove = function($index){
$scope.tasks.splice($index, 1);
}
button
. @Antiga I just changed it to ananchor
and it worked! Thanks. By the way, its not aform