一.实现http请求,需要将所需的json文件导入工程中,否则无法正确实现效果
二,http请求的代码展示
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="angular-1.3.0.js"></script>
<title></title>
<script type="text/javascript">
var app = angular.module("myApp", []);
app.value("url_book", "book.json");
app.value("url_books", "books.json");
app.controller("bookCtrl", function ($scope, $http) {
$http.get("book.json").then(function (response) {
$scope.book = response.data;
}, function (response) {
console.log(response.status);
});
});
app.c