Search code examples
typescriptionic-frameworklodash

How do i use lodash with Ionic 2?


I've just started working on a new project, using Ionic 2. I'm new to TypeScript, and have been trying to figure out how to include lodash to my project.

Is there anyone out there who has done this, and can point me in the right direction?


Solution

    1. Install lodash with npm from your terminal:

      $:npm i -S lodash 
      // npm install --save lodash (--save,-S saves to package.json)
      
    2. Import lodash in your component like this:

      import * as _ from 'lodash';