Nativescript-angular: how to import lodash for nativescript-angular

Created on 21 Sep 2016  路  7Comments  路  Source: NativeScript/nativescript-angular

PSST! Want to get faster responses to bug reports and important issues? Help us keep the issue tracker organized by:

  • Reporting bugs. Please include all details about the problem and provide a sample app.
  • Proposing features and enhancements.
  • Discussing implementation details.

Please move all other content to Stack Overflow.

question

All 7 comments

I want to use lodash for my code base.. I have installed lodash by running this command
$ npm install lodash

After this there is a folder created to my node_modules folder..
in my .ts file I have written code as like below
image

It is showing an error cannot find module 'lodash'....

Can any one please help me to try this one

image

I found this discussion that seems to cover the problem:

https://stackoverflow.com/questions/34660265/importing-lodash-into-angular2-typescript-application

@JaganJonnala, this is the development issue tracker for the NativeScript-Angular integration. Please use StackOverflow for similar questions.

Problem not solved till.... i have Done same as Code in stackoverflow

It's not working for me either :(
Any other way to do this?

In your project directory, install lodash

npm install --save lodash

Then you can use it in any .ts file

import * as _ from 'lodash';

But:

This was however failing (lodash file not found during compilation), I had to clean up the project.

tns clean-app ios

@JaganJonnala @elvismercado @Xample,

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

But end with 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 described my issue in detail on this forum post,
https://discourse.nativescript.org/t/lodash-library-in-nativescript-angular-app/4165

Any working solution on this?

Any help would be really appreciated. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VladimirAmiorkov picture VladimirAmiorkov  路  3Comments

igorls picture igorls  路  3Comments

manojdcoder picture manojdcoder  路  3Comments

vakrilov picture vakrilov  路  3Comments

EricRobertBrewer picture EricRobertBrewer  路  3Comments