I'm learning the MEAN stack but for now have not started with the db. I tried to wire the rest of the stack but it throws an error
Error: Access to restricted URI denied createHttpBackend
I googled and could not find any solutions to this problem.
This is my main controller in Angular app.js:
app.controller('MainCtrl', function($scope, $http) {
console.log("success");
$http.get('/').
success(function(data, status, headers, config) {
console.log("success");
$scope.name = data.name;
}).
error(function(data, status, headers, config) {
$scope.name = 'Error!';
})
});
My node server app.js:
var express = require('express'),
http = require('http');
var app = express();
app.set('port', 3000);
app.get('/', function(req, res) {
var name = 'MyNameFromServer';
res.send(name);
})
http.createServer(app).listen(app.get('port'), function () {
console.log('Express server listening on port ' + app.get('port'));
});
And this is the error in browser console ( when Angular http.get happens):
"Error: Access to restricted URI denied
createHttpBackend/<@file:///F:/routing/js/angular.js:9902:6
sendReq@file:///F:/routing/js/angular.js:9703:0
$http/serverRequest@file:///F:/routing/js/angular.js:9415:15
Please help me out.
This is the full app - https://github.com/V1cHu/routing
$http.get('http://localhost:3000/')instead of$http.get('/')