angularJS数据访问

以下为访问json文件:

var app = angular.module("myapp", []);
   app.controller("myctrl", function($scope, $http) {
    
    
    $http.get("dy.json").then(function success(response){
     //注意
     $scope.films=response.data.movielist;
    });

以下为访问链接地址:

var app = angular.module("myapp", []);
   app.controller("myctrl", function($scope, $http) {

    $http.get("http://result.eolinker.com/rR1VBtT56a6bb220c10b3d44b65b4787a8aec03c4ec32ce?uri=monthTest2").then(
     function success(response) {
      $scope.datas = response.data;
     }
    );

猜你喜欢

转载自blog.csdn.net/qq_42809182/article/details/81232570