RudziankoŇ≠ RudziankoŇ≠ - 2 months ago 5
Ajax Question

AngularJS: fetch json from server using AJAX

I am looking at this tutorial. And I have such code:

<!DOCTYPE html>
<html lang="en" ng-app="">
<meta charset="UTF-8">
<title>SPA book_store</title>
<script src=""></script>
<link rel="stylesheet" href="">
<script src=""></script>
<script src=""></script>

var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
.then(function(response) {
$scope.books =;

<div ng-app="myApp" ng-controller="myCtrl">
<input id="filter_input" type="text" ng-model="nameText"/>
<li ng-repeat="book in books | filter:nameText | orderBy:'name'">
{{}} - {{book.price}}


is returning following




But I see in a browser networking that request wasn't fire. What have I done wrong?


Remove the ng-app="" from the html tag or provide the module name ng-app="MyApp".

Also remove one of the ng-app directives either from the the body tag or the html tag.

It is good practice to user the ng-app directive on the HTML tag if you are using just one angular app.