Pierolain Pierolain - 8 months ago 41
AngularJS Question

Angular $http.get.error crossed in PhpStorm

I'm starting to use PhpStorm in my development. I have an issue with an Angular 1.5 project.

When I write an

error is crossed and PhpStorm shows a warning because error is deprecated in js.

How can I solve this?

I already added Angularjs as library in my project.


Here's angular's documentation on this issue:

The $http legacy promise methods success and error have been deprecated. Use the standard then method instead.

The then function allows you to handle both success and error situations in promise based functions:

$http.get(url).then(function(response) {
    // handle promise resolve...
}, function(error) {
    // handle promise reject...