0

I'm a newbie to angularjs and on the first example I try out for $http.get I get "Uncaught Error: [$injector:modulerr] Failed to instantiate module getHubViewer due to: Error: [$injector:nomod] Module 'getHubViewer' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument."

When I comment the get call, everything works just fine. Could anyone please help.

url: http://plnkr.co/edit/Ww4S2GgVXYGauwdbINJS?p=preview

<html ng-app="getHubViewer">

  <head>
    <script data-require="[email protected]" data-semver="1.3.0" src="//code.angularjs.org/1.3.0/angular.js"></script>
    <link rel="stylesheet" href="style.css" />
    <script src="script.js"></script>
  </head>

  <body ng-controller="MainController">
    <h1>{{message}}</h1>
  </body>

</html>

script.js:

(function() {
  var app = angular.module("getHubViewer", []);
  var MainController = function($scope, $http) {
    //var promise = $http.get('https:\\api.github.com\users\robconery');
    $scope.message = "Hello, Angular";
  };
  app.controller("MainController", ["$scope","$http",MainController]);
}());

Thanks

3 Answers 3

1

You need to change the backslashes to a slash:

var promise = $http.get('https://api.github.com/users/robconery');

It says "Unknown symbol" before the error you wrote. Search for those errors, they're less conspicuous than the long angular error messages, and they're usually what's causing the issue.

Plunker

Sign up to request clarification or add additional context in comments.

1 Comment

I would say that the backslash needs to be forward slash... otherwise its a pretty strange URL :).
1

use / instead of \ in url patern you shoud be use /

var promise = $http.get('https://api.github.com/users/robconery');

Comments

0

You're using the wrong "slashes". URLs consist of simple slashes "/" instead of the backslahes you are using.

Use https://api.github.com/users/robconery instead of https:\api.github.com\users\robconery

The error speaks for itself: "Illegal character". The backslash is reserved for escaping certain special characters.

Comments

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.