0

I am using AngularJS, and when I use http call, the menu disappears if the request returns 404 not found.

When the http call is ok, every thing works fine.

this is my code

this.fetchList = function () {
    var url = '/api/getlistmanager';
    return $http.get(url).then(function (response) {
        return response.data;
    }).catch(function (response) {
        if(response.status==404)
            response.status=500;
        return response.status;
    }).finally(function () {
           ;
    });
};

Any idea please for catching this type of call without blocking the menu?

thanks for help

Sébastien
  • 11,860
  • 11
  • 58
  • 78
Majdi Taleb
  • 731
  • 3
  • 9
  • 26
  • what do you mean by *menu disappear after http call*? – Pankaj Parkar Mar 16 '18 at 15:45
  • Is that because your data is not returned when there is an error? In other words, you don't do `return response.data;` if there is an error, so maybe the menu rendering is dependent on that data? – Frank Modica Mar 16 '18 at 15:48
  • yes after http call, there are no data returned of course, because http call return 404 not found. – Majdi Taleb Mar 16 '18 at 16:09
  • can you add your template code as well? It's hard to imagine what do you mean by 'menu disappear'! – JPS Mar 16 '18 at 16:33

0 Answers0