2

ajax リクエストに jquery ではなく Angular を使用するタイミングがわかりません。

たとえば、次のように使用する必要があるのはなぜですか。

function ItemListCtrl ($scope, $http) {
    $http.get('example.com/items').success(function (data) {
    $scope.items = data;
  }
}

それ以外の

  function ItemListCtrl ($scope) {
        $.ajax({type: "GET", url: 'example.com/items',
        success: function (result) {                    
                             $scope.items = data;
                    }
    });
   }

??

4

1 に答える 1