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

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -