I\'m creating a personal website where I can keep updating content without having to manipulate the HTML
. I\'m trying to achieve this by simply loading and updating
Change your mainController.js and JSON files as follows. Here i'm using wamp server as my local server.
var myapp = angular.module('mainApp', []);
myapp.controller('mainController', function($scope, $http) {
$http.get('http://localhost/stackoverflow/angular/test1/database.json').success (function(data) {
$scope.contents = data.records;
})
});
JSON File:
{
"records":
[
{"heading":"MyHeading","description":"myDescription"}
]
}