I am using AngularJS and Typescript. In my controller constructor, I make a call to a function that gets data and returns a promise. The promise is stored in the variable x
.
x.then((data) => {
//displays data
}, (err) => {
//sends error message
});
Right now if the promise never resolves, it displays nothing. I want to use $timeout
so that if the resolution of x
takes too long it will display another message. I don't know how I can do it for promises. Calling this.$timeout(3000,true).then(() => {});
just delays the contents and I can delay a function. How can I abort if the promise doesn't resolve?