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