<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
        <script src="http://cdn.bootcss.com/angular.js/1.3.8/angular.min.js"></script>
        <script src="http://cdn.bootcss.com/angular.js/1.3.8/angular-resource.min.js"></script>
    </head>
    <body>
      <div ng-app="myApp">
          <div ng-controller="firstController">
           {{name}}
           {{data.name}}
          </div>
      </div>
      <script type="text/javascript">
          var app = angular.module('myApp',['ngResource']);
          app.controller('firstController',['$scope','$resource',function($scope,$resource){
              var obj = $resource('lisi.json');
          $scope.data1 = obj.get();
              $scope.data = obj.get({name:'zhangsan'},function(data){//请求zhangsan.json
                  console.log(data);
                  console.log(data.name);
              },function(error){
                  console.log(error);
              });
              console.log($scope.data);
              $scope.name = '张三';
          }]);
      </script>
    </body>
</html>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
        <script src="http://cdn.bootcss.com/angular.js/1.3.8/angular.min.js"></script>
        <script src="http://cdn.bootcss.com/angular.js/1.3.8/angular-resource.min.js"></script>
    </head>
    <body>
      <div ng-app="myApp">
          <div ng-controller="firstController">
           {{name}}
           {{data.name}}
          </div>
      </div>
      <script type="text/javascript">
          var app = angular.module('myApp',['ngResource']);
          app.controller('firstController',['$scope','$resource',function($scope,$resource){
              var obj=$resource(':name.:type');
            //  $scope.data=obj.get();
              $scope.data=obj.get({name:'lisi',type:'json'},function(data){//请求lisi.json
                  console.log(data.name);
              },function(error){
                  console.log(error);
              });
            console.log($scope.data);
              $scope.name = '张三';
          }]);
      </script>
    </body>
</html>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
        <script src="http://cdn.bootcss.com/angular.js/1.3.8/angular.min.js"></script>
        <script src="http://cdn.bootcss.com/angular.js/1.3.8/angular-resource.min.js"></script>
    </head>
    <body>
      <div ng-app="myApp">
          <div ng-controller="firstController">
           {{name}}
           {{data.name}}
             <ul>
                 <li ng-repeat="d in data">
                     {{d.name}}--{{d.age}}
                 </li>
             </ul>
          </div>
      </div>
      <script type="text/javascript">
          var app = angular.module('myApp',['ngResource']);
          app.controller('firstController',['$scope','$resource',function($scope,$resource){
              var obj=$resource(':name.:type');
            //  $scope.data=obj.get();
              $scope.data=obj.query({name:'zhangsan',type:'json'});
             console.log($scope.data);
              $scope.name = '张三';
          }]);
      </script>
    </body>
</html>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
        <script src="http://cdn.bootcss.com/angular.js/1.3.8/angular.min.js"></script>
        <script src="http://cdn.bootcss.com/angular.js/1.3.8/angular-resource.min.js"></script>
    </head>
    <body>
      <div ng-app="myApp">
          <div ng-controller="firstController">
           {{name}}
           {{data.name}}
             <ul>
                 <li ng-repeat="d in data">
                     {{d.name}}--{{d.age}}
                 </li>
             </ul>
          </div>
      </div>
      <script type="text/javascript">
          var app = angular.module('myApp',['ngResource']);
          app.controller('firstController',['$scope','$resource',function($scope,$resource){
              var obj=$resource(':name.:type',{type:'json'});
            //  $scope.data=obj.get();
              $scope.data=obj.query({name:'zhangsan'});
             console.log($scope.data);
              $scope.name = '张三';
          }]);
      </script>
    </body>
</html>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
        <script src="http://cdn.bootcss.com/angular.js/1.3.8/angular.min.js"></script>
        <script src="http://cdn.bootcss.com/angular.js/1.3.8/angular-resource.min.js"></script>
    </head>
    <body>
      <div ng-app="myApp">
          <div ng-controller="firstController">
           {{name}}
           {{data.name}}
             <ul>
                 <li ng-repeat="d in data">
                     {{d.name}}--{{d.age}}
                 </li>
             </ul>
          </div>
      </div>
      <script type="text/javascript">
          var app = angular.module('myApp',['ngResource']);
          app.controller('firstController',['$scope','$resource',function($scope,$resource){
              //var obj=$resource(':name.:type',{type:'json'});
              var obj = $resource('http://www.57lehuo.com/json.php',
                      {id:'@id'},{getAge: {method: 'GET', params: {age:'40'},isArray: false},
                          getSex: {method: 'GET', params: {sex:'nv',age:'32'},isArray: false}});
              $scope.data=obj.get({id:'20'});
              $scope.data2=obj.getAge({id:'21'});
              $scope.data3=obj.getSex({id:'21'});
              //$scope.data=obj.query({name:'zhangsan'});
              console.log($scope.data);
              console.log($scope.data2);
              console.log($scope.data3);
              $scope.name = '张三';
          }]);
      </script>
    </body>
</html>