javascript - AngularJS and JSON -


i have simple html-file , json-file

<!doctype html>  <html lang="en" ng-app="myapp">  <head>      <meta charset="utf-8">      <title>document</title>  </head>  <body>      <div ng-controller="aboutcontroller">          <p ng-repeat="post in about">              {{name.about}}          </p>      </div>      <script src="angular.js"></script>      <script>          var myapp = angular.module('myapp', []);          myapp.controller('aboutcontroller', function($scope, $http) {              $http.get('about.json').success(function(data, status, headers, config) {                  $scope.about = data;                  console.log('this data:',data);              });          });      </script>  </body>  </html>

{      "name" : "peter",      "surname" : "chpoksky"  }

i need transfer data json-file, reason, browser displays nothing problem?

in json json :

{ "name" : "peter", "surname" : "chpoksky" } 

so use object have

      <p ng-repeat="post in about">         {{post.name}}  <!-- display name -->        {{post.surname}}  <!-- display surname -->     </p> 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -