2016-12-22 3 views
0

私は現在wso2炭素で働いています。私は1つのガジェットを開発し、成功したガジェット-util.jsがwso2 carbon修正方法getGadgetLocationで未定義のプロパティ 'getTenantDomain'を読み取れませんか?

var getGadgetLocation = function (callback) { 
    var gadgetLocation = "/portal/store/carbon.super/fs/gadget/circle_d3"; 
    var PATH_SEPERATOR = "/"; 


    if (gadgetLocation.search("store") != -1) 

{ 

     wso2.gadgets.identity.getTenantDomain(function (tenantDomain) { 


      var gadgetPath = gadgetLocation.split(PATH_SEPERATOR); 
      var modifiedPath = ''; 
      for (var i = 1; i < gadgetPath.length; i++) { 
       if (i === 3) { 
        modifiedPath = modifiedPath.concat(PATH_SEPERATOR, tenantDomain); 
       } else { 
        modifiedPath = modifiedPath.concat(PATH_SEPERATOR, gadgetPath[i]) 
       } 
      } 
      callback(modifiedPath); 
     }); 
    } else { 
     callback(gadgetLocation) 
    } 
    callback(gadgetLocation); 
} 

くれ

+0

キャッチされない例外TypeError:あなたは、JavaScriptから達成しようとしているかを説明することができ、未定義 – shrisai7

+0

のプロパティ「getTenantDomain」を読み取ることができませんか? –

答えて

0

を助けてくださいであるだけでなく統合されますが、ガジェット-util.jsファイルが

Uncaught TypeError: Cannot read property 'getTenantDomain' of undefined 
     at getGadgetLocation 

私のコードのエラーを示していますgadget.xmlでID機能[1]を要求する必要があります

<Require feature="wso2-gadgets-identity" /> 

たとえばhttps://github.com/wso2/product-das/blob/master/modules/distribution/src/repository/conf/template-manager/gadget-templates/numberchart/gadget.xml#L5

[1] http://mail.wso2.org/mailarchive/dev/2016-August/066568.html