Subtubes
Subtubes

Reputation: 16883

How to test if a function returns a angularJS promise object

I am trying to test if a function returns an angularjs promise but there doesn't seem to be a good way to test for this can someone illuminate me?

Upvotes: 1

Views: 504

Answers (1)

Tai Huynh
Tai Huynh

Reputation: 609

You can use:

if(angular.isFunction(yourFunction().then)){
  //yourFunction returns an angularjs promise.
}

Upvotes: 2

Related Questions