How to include and use node modules in your Ionic / AngularJs app?

后端 未结 3 647
广开言路
广开言路 2020-12-14 16:36

I have an Ionic app and I\'d like to include the node module angular-base64 to use in my controllers, or even wrap inside an angular service etc. I\'ve gone ahead and ran

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-14 17:05

    The accepted answer is no longer accurate for Ionic V2 and the .bowerrc was removed from default installation.

    Here is how you do it now, from the official Ionic V2 docs.

    To add a third party library to an app, run the following command:

    npm install --save

    eg: Using the imported function

    // named export pattern

    import { myFunction } from 'theLibraryName';

    ...

    // use the imported functionality

    myFunction();

提交回复
热议问题