Angular Base64
An angular factory implementation of the javascript base64 algorithm as proposed by ncerminara
You can view the original gist here
I have rewritten the library to be more in line with module design in angular 1.6. Additionall the code has been cleaned up to allow for minification and we have build a minified version into the release.
Install with npm and link to the installed file using the script tag
npm install ng-base64
Add a reference to angular-base64.js in your html:
<script src="<PATH>/angular-base64.js" type="text/javascript"></script>
or
<script src="<PATH>/angular-base64.min.js" type="text/javascript"></script>
Add a reference to ngBase64 in angular application config section:
var myApp = angular.module('myApp',
[
'ngBase64'
]);
Inject base64 into a controller or directive in your application:
.controller('AppCtrl', function($log, base64) {
$log.log(base64.encode('Hello World!'));
$log.log(base64.decode('SGVsbG8gV29ybGQh'));
})
Enjoy!