Jay Jay - 28 days ago 8
AngularJS Question

angular.min.js XMLHttpRequest cannot load file

[![



/* app.js */

var model = angular.module('app',['ui.router']);

model.config(function($stateProvider, $urlRouterProvider){

$urlRouterProvider.otherwise('/home');

$stateProvider

.state('home',{
url: '/home',
templateUrl: 'view/home.html',
controller: 'homeController'
})

});

/* home.js */

model.controller('homeController',function($scope){

});

<!-- index.html -->

<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="js/angular.min.js" ></script>
<script type="text/javascript" src="js/angular-ui-router.min.js" ></script>
<script type="text/javascript" src="controller/app.js" ></script>
<script type="text/javascript" src="controller/home.js" ></script>
</head>
<body ng-app="app">
<header>Jayesh Shelar</header>
<div id="view" ui-view> </div>

</body>
</html>





]1]1HI

I am getting error as "angular.min.js:103 XMLHttpRequest cannot load file Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource."

Answer

You can do npm install http-server -g and start the server in your project folder by using http-server command.

Comments