totaljs / Tangular

A simple JavaScript template engine like Angular.js for websites or node.js
MIT License
61 stars 21 forks source link

Multiple filters not work #3

Closed motizharfati closed 9 years ago

motizharfati commented 9 years ago
var _ = require('lodash');
var Tangular = require('Tangular');

Tangular.register('slice', function(item, from, to) {
    if (!to) {
        return item.slice(0, from);
    }
    return item.slice(from - 1, to - 1);
});

Tangular.register('uppercase', function(item) {
    return item.toUpperCase();
});

Tangular.compile('hello {{world|slice(1,5)|uppercase}}')({ world: 'I am the alpha and the omega' })
petersirka commented 9 years ago

Hi @motizharfati, Tangular doesn't support multiple filters but as idea is very interesting. I'll try to add it.

Thanks for tip.

petersirka commented 9 years ago

I have added it. Thanks.