javascript - prepend using orderBy in angularjs -
as can see using push, item inserted last item in list, how can prepend it?
http://jsfiddle.net/u3pvm/2875/
$scope.todos.push({text:$scope.todotext, done:false});
i'm confused 2nd argument in here : orderby : **'some_id'** : reverse
some_id can var in js right?
use unshift() method on array add item @ beginning
$scope.todos.unshift({text:$scope.todotext, done:false});
about unshift: unshift() method adds 1 or more elements beginning of array , returns new length of array
demo: jsfiddle demo
source: unshift
Comments
Post a Comment