Lodash library in Nativescript angular app


Hey All,

I am trying to use lodash library in Nativescript angular application.

  • This is how i have tried,
npm i --save lodash

In Component.ts

import * as _ from "lodash";
// import chain from "lodash/chain";
   this.reportTypes = masterData[6];

                "fileName": '',
                "attachmentTypeId": 101,
                "attachmentTypeDesc": _(this.reportTypes).chain().where({'attachmentTypeId':101}).pluck('attachmentTypeDesc').toString(),
                "Comments": ''
  • Its throwing below mentioned error,
JS: ERROR Error: Uncaught (in promise): TypeError: _(...).chain(...).where is not a function
JS: TypeError: _(...).chain(...).where is not a function
  • I have looked on this stackoverflow post. But i didn’t get any,

I am not sure how to import/use the lodash/chain.

Please suggest the way to use lodash with NS angular.