2015-02-24 61 views
0

我已經設置了一個角度應用程序,它使用了pivot.js tp構建一個數據透視表。我得到一個錯誤如何在角度應用程序中使用Pivot.js?

"Cannot read property 'derivers' of undefined" 

這裏是代碼:

HTML:

app.js

routerApp.controller('productPivot',['$scope','$http','$objectstore',function($scope,$http,$objectstore){ 
    $scope.products = []; 
    var client = $objectstore.getClient("com.duosoftware.test","product"); 
     client.onGetMany(function(data){ 
     if (data){ 
      $scope.products = data; 
      var derivers = $.pivotUtilities.derivers; 
     $("#productsPivotTableOutput").pivotUI($scope.products, { 
      rows: ["Name"], 
      cols: ["CanBeSold"], 
      rendererName: "Table" 
     }); 

     } 
     }); 
    client.getByFiltering("*"); 
}]); 

我必須在某處注入樞軸js嗎?這是我遵循的示例! Pivot with angular

+0

你加載了你的pivot.js嗎? – 2015-03-02 06:27:41

回答

-1

我終於做到了。這裏是工作Plnker,

我們需要加載角度和jQuery後加載pivot.js。

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.js"></script> 
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular-animate.js"></script> 
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular-aria.js"></script> 
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js"></script> 
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.js"></script> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pivottable/1.3.0/pivot.min.js"></script> 
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pivottable/1.3.0/pivot.min.css" /> 
+1

沒有發現盜賊/鏈接被破壞 – Ram 2017-10-26 15:03:54

+0

它曾經工作,這就是爲什麼答案被標記,可能我已經刪除了盜賊,將盡快發佈 – Sajeetharan 2017-11-11 14:55:53

相關問題