Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
342 views
Welcome To Ask or Share your Answers For Others

1 Answer

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);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...