0

I'm trying change https://akveo.github.io/blur-admin/ project. Its controllers are all in js format and I can't migrate them to typescript. So now I can't import any libraries to my controllers (I wanted to use socket.io-client to make a backend with java). I am trying this code

$http.get('http://localhost/aa.php').then(function (response) {
        $scope.period_day = response;
    }).catch(function (err) {
        console.log(err);
    });

but result is :

Object { data: null, status: -1, headers: headersGetter/<(), config: Object, statusText: "" }

But when I open this url in my browser it works fine. Now I just want to make http request to communicate my backend and I don't have any solution. (BlurAdmin project is developed with gulp)

7
  • require(packageName); does not work? Commented Jun 19, 2019 at 17:06
  • No it seems this project need angular 11 (I don't know if it is allowed in new version) and it cant use require in js controller Commented Jun 19, 2019 at 17:48
  • $http.get('http://localhost/aa.php').then(function (response) { $scope.period_day = response.data; }) is what you need. Therefore, read the documentation as this has nothing to do with TypeScript or JavaScript, it's elementary API use error. Commented Jun 19, 2019 at 19:01
  • It doesn't work again :( As I said , response is wrong with status code -1 Commented Jun 19, 2019 at 19:21
  • Make sureyou are injecting the $http service into your controller Commented Jun 19, 2019 at 19:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.