为什么下面的程序没有给出正确的输出?

时间:2016-05-02 16:44:42

标签: angularjs

问题描述:以下程序没有给出正确的输出,因为它只显示"本地区"程序员的姓名和年龄"并没有显示我在.json文件中提供的人员信息

> Blockquote

<!DOCTYPE html>

><html>
><head>
><script     src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
><script src="http.js"></script>
></head>
><body ng-app="myApp">
><div ng-controller="people">
><ul>
><h2>Names and Age of programmars in local area</h2>
><li ng-repeat = "person in persons">
>{{ person.Name + ' : ' + person.Age }}
></li>
></ul>
></div>
></body>
></html>
> 
>   

    >var app = angular.module("myApp", []);
    >app.controller("people", function($scope, $http) {
    >   $http.get("records.json")
    >   .success(function(response) {
    >       $scope.persons = response.records;
    >   });
    >});


enter code here


    >var myJSON = {


    >   "records": [
    >   {`
    >       "Name":"Mehul",
    >       "Age":"15"
    >   },
    >   {
    >       "Name":"Mehul",
    >       "Age":"19"
    >   },
    >   {
    >       "Name":"anil",
    >       "Age":"18"
    >   },
    >   {
    >       "Name":"pawan",
    >       "Age":"18"
    >   }

    >]};

0 个答案:

没有答案