Home Angular http get no response from api
Reply: 0

Angular http get no response from api

user1475 Published in March 18, 2018, 2:07 am

I am trying to get any information with Angular from the local api that I have created in Ruby, Sinatra platform. I am sure that the api is running on the port 4567 since I can see the data if i access m it directly through web interface. When I do that I see this (just next to the number 0 there is like a small arrow so it is possible to minimize the details of the object):

 id "1"
 name   "Company-A21"
 address    "Gany-A11"

If I want to see RAW data I get this:


On the "other side" I am running apache2 and this HTML file:

    <!doctype html>
<html >
        <title>Hello AngularJS</title>
        <script src="hello.js"></script>

        <div ng-controller="Hello">
            <p>The ID is {{company.id}}</p>
            <p>The content is {{company.name}}</p>

And the hello.js:

angular.module('demo', [])
.controller('Hello', function($scope, $http){

    then(function(response) {
            $scope.company = response.data;

Why I can not see response? I just started to practice Angular and I stuck here...

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.296916 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO