angular-base64

WebJar for angular-base64

Лицензия

Лицензия

MIT
Категории

Категории

Angular Взаимодействие с пользователем Веб-фреймворки
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

angular-base64
Последняя версия

Последняя версия

2.0.5
Дата

Дата

Тип

Тип

jar
Описание

Описание

angular-base64
WebJar for angular-base64
Ссылка на сайт

Ссылка на сайт

https://www.webjars.org
Система контроля версий

Система контроля версий

https://github.com/ninjatronic/angular-base64

Скачать angular-base64

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/angular-base64/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>angular-base64</artifactId>
    <version>2.0.5</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/angular-base64/
implementation 'org.webjars.npm:angular-base64:2.0.5'
// https://jarcasting.com/artifacts/org.webjars.npm/angular-base64/
implementation ("org.webjars.npm:angular-base64:2.0.5")
'org.webjars.npm:angular-base64:jar:2.0.5'
<dependency org="org.webjars.npm" name="angular-base64" rev="2.0.5">
  <artifact name="angular-base64" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='angular-base64', version='2.0.5')
)
libraryDependencies += "org.webjars.npm" % "angular-base64" % "2.0.5"
[org.webjars.npm/angular-base64 "2.0.5"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.npm : angular jar [1.0.8,)

Модули Проекта

Данный проект не имеет модулей.

angular-base64

Encapsulation of Nick Galbreath's base64.js library for AngularJS

For Base64 encoding which supports UTF8 see angular-utf8-base64

Installation

Bower

bower install angular-base64

NB: The ngBase64 bower package is deprecated due to camel casing issues on case-sensitive file systems.

<script src="bower_components/angular-base64/angular-base64.js"></script>

NPM

npm i angular-base64

Usage

angular
    .module('myApp', ['base64'])
    .controller('myController', [
    
        '$base64', '$scope', 
        function($base64, $scope) {
        
            $scope.encoded = $base64.encode('a string');
            $scope.decoded = $base64.decode('YSBzdHJpbmc=');
    }]);

Requiring NPM module when using Browserify

angular
    .module('myApp', [ require('angular-base64') ])
    .controller('myController', [
        '$base64', '$scope',
        function($base64, $scope) {

        $scope.encoded = $base64.encode('a string');
        $scope.decoded = $base64.decode('YSBzdHJpbmc=');
    }]);

Unicode

You can encode unicode strings using base64 as described here.

angular
    .module('myApp', ['base64'])
    .controller('myUnicodeController', [
    
        '$base64', '$scope', 
        function($base64, $scope) {
        
            $scope.encoded = $base64.encode(unescape(encodeURIComponent('✓ a string')));
            $scope.decoded = decodeURIComponent(escape($base64.decode('4pyTIGEgc3RyaW5n')));
    }]);

URL Safety

If you want to transmit a base64 encoded string in a url you must make it "URL safe" by encoding it with encodeURIComponent.

var base64EncodedString = $base64.encode('a string');
var urlSafeBase64EncodedString = encodeURIComponent(base64EncodedString);

To decode the above string use decodeURIComponent, then decode.

var base64EncodedString = decodeURIComponent('YSBzdHJpbmc%3D');
var decodedString = $base64.decode(base64EncodedString);

Версии библиотеки

Версия
2.0.5