Ranter
Join devRant
Do all the things like
				++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
				Sign Up
			Pipeless API
				From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
				Learn More
			Comments
		- 
				
				
cahva10119yUsing rest api with promises is normal, just like fetch is a promise. What do you mean that it does not work well with your rest api? With promises you can easily chain stuff and catch errors for example:
// RestService is just a wrapper to different $http stuff
restService.doSomething()
.then((response) => {
// Do something with the response
vm.someangularvar = response.data;
})
.catch((error) => {
// Handle the error from api
});
BTW, this is angular 1.5 style, I haven't started angular 2 but ajax calls are the same I think.. - 
				
				@cahva Thanks for the advice. I'm still learning and didn't really do frontend before. Also, every tutorial for calling to an api thats on a remote server with the http module, used observables
 - 
				
				As long as you're only expecting one result per call, promises are fine for a rest API. Learn how to do observables too, though, they're cool.
Although they use array-like functions, they run on each result instead of each element. Understanding that concept helped me. 
Related Rants

Source: /r/ProgrammerHumor
A follow up to the last rant.
Trying to get that angular working with my rest api. But frickin observables and promises. I built my angular based on the official tutorial from the angular website. Sadly that tutorial uses promises, which aren't that suited for communicating with an api. So now I'm learning/implementing observables into the angular.
BUT I'M GETTING SO MUCH ERRORS. CONFUSION IS RISING.
I need more coffee to do this. :/
undefined
observables
angular
php
promises