2017-10-09 153 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