Base64 conversion for AngularJS