Truncated Mustache RactiveJS Events

I have a paging function, as it is a little difficult to do in templates. The problem is that if I put it like this:

{{ paging( rows, limit, offset ) }}

Obviously, it will not output a conclusion, so I tried with a triple stash, and the output will be as expected. But then he will no longer detect events on-click.. any suggestions?

The workaround I was thinking of is setting jQueryto detect the event clickin .pagination > li, but I just wanted to ask if there is a way that RactiveJS can do for me, or I just missed something.

Have a great day!

0
source share
1 answer

, :

data: {
    foo: 'foo',
    paging: function(x){
        var template = '<li on-click="clicked()">' + x + '</li>';
        if (!this.partials.paging) {
            this.partials.paging = template;
        }
        else {
            this.resetPartial('paging', template);
        }
        return 'paging';
    }
},

. http://jsfiddle.net/fz7adjm4/

+2

Source: https://habr.com/ru/post/1650126/


All Articles