I am trying to include angular.js into a project I am working on. I am new to angular. Angular does not seem to be reading my json file and I am not sure what I am doing wrong. I made a test file below that mimics what I am doing at a smaller scale. If anyone can explain to me what I am doing wrong, it would be much appreciated.
Index.html
<!DOCTYPE html>
<html>
<head>
<meta charset = "UTF-8">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src='app.js'></script>
<script src='MainController.js'></script>
<title>angular test</title>
</head>
<body>
<h1>Angular Test</h1>
<div ng-app = 'myApp' ng-controller='MainController'>
<p>{{myData}}</p>
</div>
</body>
controller.js
app.controller('MainController', function($scope, $http) {
$http.get("data.json").then(function(response) {
$scope.myData = response.data.test;
});
});
app.js
var app = angular.module('myApp',[]);
data.json
{
"test":"This data is from a json file"
}