Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Angular.noop used for?

I have tried searching it everywhere even on Angular.org documentation but couldn't find any detailed explanation with implementation. It would be hugely helpful if any could explain it.

like image 377
Harsh Avatar asked Mar 12 '14 10:03

Harsh


1 Answers

angular.noop is an empty function that can be used as a placeholder when you need to pass some function as a param.

function foo (callback) {     // Do a lot of complex things      callback(); }  // Those two have the same effect, but the later is more elegant foo(function() {}); foo(angular.noop); 
like image 134
tomaoq Avatar answered Nov 12 '22 20:11

tomaoq