Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
194
rated 0 times [  196] [ 2]  / answers: 1 / hits: 41302  / 9 Years ago, thu, august 27, 2015, 12:00:00

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



npm install angular-base64


Which went ahead and installed the folder containing angular-base64.min.js file inside /myIonicApp/node_modules/. So the full path to the file is /myIonicApp/node_modules/angular-base64/angular-base64.min.js .



However when I try and make use of the module in one of my controllers like this:



app.controller('myController', ['$scope', '$base64',
function($scope, $base64) {

//$base64...

}
]);


It has no idea what I'm talking about. Do I have to do something else to get this to work? Perhaps something in my app.js?


More From » angularjs

 Answers
73

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();



[#65278] Monday, August 24, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dawnc

Total Points: 612
Total Questions: 94
Total Answers: 98

Location: Sweden
Member since Fri, Apr 16, 2021
3 Years ago
dawnc questions
Fri, Nov 26, 21, 00:00, 3 Years ago
Wed, Jul 15, 20, 00:00, 4 Years ago
Sun, Dec 15, 19, 00:00, 5 Years ago
Thu, May 30, 19, 00:00, 5 Years ago
;