- npm i
- gulp generate --name abl-module-name
This will regenerate new module source code, package.json, and file names with the name argument you specify, in this example abl-module-name
- npm run start
- http://localhost:9999 in your browser.
- Packed module is output to ./dst folder.
The sample Angular Material application to test your module during development is located in the ./samples folder.
- npm run build
- Include the webpacked .js file: ./dst/currency-component.js
- Include the module in your app dependencies:
angular
.module('app', [
'currency-component'
]);- Using the filter:
<span flex>{{ $ctrl.price | ablCurrency: 'eur' }}</span>app.run(function($ablCurrencyComponentProvider) {
//this will be used if no currencyFilter is defined
$ablCurrencyComponentProvider.defaultCurrency = 'usd';
//if this is true the filter will use 'defaultCurrency' in the whole app. Default: false
$ablCurrencyComponentProvider.uniqueCurrency = false;
//Add an array with extra currencies.
//Example: {name:'abc', symbol:'#', symbolSeparation:' ', position:'append'} => 12345 #
$ablCurrencyComponentProvider.currencies = [{ name: 'cl', symbol: '#', symbolSeparation: '', position: 'prepend' }];
})vm.price = 1234567890;<span flex>{{ $ctrl.price | ablCurrency: 'eur' }}</span>vm.price = 1234567890;
vm.currencyFilter = 'usd';<span flex>{{ $ctrl.price | ablCurrency: $ctrl.currencyFilter }}</span>vm.price = 1234567890;
vm.currencyFilter = 'usd';
vm.html = 'html';<span flex>{{ $ctrl.price | ablCurrency: $ctrl.currencyFilter : $ctrl.html }}</span>