AngularHarsh AngularHarsh - 11 months ago 68
AngularJS Question

What is Angular.noop used for?

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

Answer Source

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


// Those two have the same effect, but the later is more elegant
foo(function() {});