Difference between AngularJS standard $http and NgResource - angularjs

Who can tell me at least 5 differences AngularJS standard $http and NgResource?
Expect that NgResourse is better for RESTfull Api.I searched for this but didn't find a good answer:(

Related

AngularJS, Services and promises, best practice 2018

Basically, I am building a massive app, using SailsJS and AngularJS.
I'm ratter new to both of them.
I've started this app with few Controllers, but seeing how it's getting messy, I started to move the interaction with my Backend API into Services (mostly the $http functions). I quickly noticed that the "asynchonousity" of it messed most of my logic.
I never used the $q of Angular, and $http kind of do it by itself so I looked online to see the best practice and found this post : AngularJS services and promises best practice
As it's from 2016, I was wondering if it is still considered the best practice, and if it is exactly like that that I should build my Services.
It still is considered the best practice. You can use Promise Chaining in order to structure your code timewise.
You may want to see this article for further details.

What is the difference between $http and $resource?

Can I use either for a REST call ? Or is there some minor difference ? I have used both of them in my projects with no side effects,
These are the main differences between $http and $resource:
$http:
$http is for universal purpose. It is an Ajax call.
$http is built into the AngularJS framework.
$http is good for quick retrieval.
$http is injected directly into an AngularJS controller by the developer.
For more details about $http refer: https://docs.angularjs.org/api/ng/service/$http
$resource:
$resource wraps $http to use in RESTful web APIs.
$resource needs to add the module separately.
$resource is good for conditions slightly more complex than $http.
$resource does not allow us to do much with data once it is consumed in the application. It is in the final state when it is delivered to the HTML DOM. The data are the same that the $http method will receive.
For more details about $resource refer: https://docs.angularjs.org/api/ngResource/service/$resource
You can find more answer here and here.

Good Angular Tutorials for Consuming Rest API's

Have we got some good, easy to use tutorials for working with API's? Im writing a UI for an API im developing and want to really learn how to use AngularJS properly.
thanks
In Angular, the $resource service is designed specially for consuming REST services. You can find the documentation (and a few samples) for $resource at https://docs.angularjs.org/api/ngResource/service/$resource.

Angular resource and $http.put

What's the difference between using $resource to make a put request and using $http.put to make a put request? Does it make any difference in the speed or performance?
Check Answers in this stackoverflow thread
$resource is further high-level abstraction of $http. I don't think $resource added significant performance burden on top of $http to get the high-level API .

Good Practices of AngularJS

After searching for hours in google and stackoverflow, I did not get the answer for good practices for AngularJS.
My Questions Are ::
1) Is it a good practice to manipulate a DOM using JQuery and CSS in AngularJS?
2) When to add $injector and $inject explicitly?
3) Is it good practice to use JQuery's $.ajax() method to call the asynchronously in the controller of a Module?
1) Is it a good practice to manipulate a DOM using JQuery and CSS in AngularJS?
You may be surprised how much Angular can do without jQuery. However, jqLite is certainly a "lite" version of jQuery. If you can't do it "clean" in Angular (e.g., if you find yourself writing parent().parent() instead of closest('.element-wrapper')) then sure, reach for jQuery.
2) When to add $injector and $inject explicitly?
Normal dependency injection is usually sufficient. You could, however, dynamically inject a service using the $injector, if you really need to: AngularJS dynamically inject scope or controller
3) Is it good practice to use JQuery's $.ajax() method to call the asynchronously in the controller of a Module?
Use $http or $resource. They do things $.ajax() doesn't, e.g., they'll initiate an AngularJS digest cycle when results come back from the server. Often, you'll want to put your server interaction code into an Angular service.

Resources