2017-10-09 32 views
0

我想在我的角應用程序中使用來自lodash的._get()._find()(從下劃線中找到)。由於標準版本中沒有默認值,我需要創建一個自定義版本。_使用自定義構建lodash時未定義

通過lodash cli我有runnend這個命令:lodash include=get,find。我已將生成的lodash.custom.js包含到我的項目中。

但現在我越來越對我想使用的功能的

ReferenceError: _ is not defined

錯誤。

var matchedShopProduct = _.find($rootScope.currentShop.products, {_id: formattedProduct._id}); 

var value = _.get($scope.product.versions[i].modifiedProperties[0], property); 

我想我錯過了構建定製構建的東西,但我找不到。

回答

0

通過在命令中添加exports=admin,global來解決此問題。 所以完整的命令是:

lodash exports=amd,global include=get,find