ractivejs

Ractive computed property

我们两清 提交于 2019-12-11 15:00:08
问题 I've got a simple test application using firebase with the following template and model in ractive. I want to access the price value in the computed newprice to format it to look like currency with 2 decimal places. I can't figure out though how to get at the .price value which displays fine in the output but nothing I've tried seems to be able to see .price inside the computed. The call to newprice works fine as I can just return text and see it in the output. The reason it am using .price

how to use ractive as view component in backbone.js [closed]

允我心安 提交于 2019-12-11 13:27:18
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . I am new to ractive.js and want to integrate it with backbone.js. I found a backbone adapter for ractive howevere didn't found a sample which will show to use it effectively. Need a sample that explain how to use ractive.js as a view component in backbone.js 回答1: Since the

Ractivejs decorator inconsistently initialized

不打扰是莪最后的温柔 提交于 2019-12-11 10:41:52
问题 ref: http://jsfiddle.net/ffmqd0zz/ html: <div id='books_container'/> <script type='ractive/template' id="books"> {{#books}} <div decorator='decoration' id="{{id}}"> <span> title: {{ title }}</span> <span> id: {{ id }}</span> </div> {{/books}} </script> javascript: var MyDecorator = function(node) { console.log("init MyDecorator for id: " + $(node).attr('id')); return { teardown: function() {}}; }; var books = new Ractive({ el: '#books_container', template: '#books', data: {books: [{"id": 1174

ractivejs component nesting

徘徊边缘 提交于 2019-12-11 09:00:51
问题 The documentation seems to indicate that it is possible to nest custom components within other custom components (http://docs.ractivejs.org/latest/components) : <Foo on-Bar.foo="barfooed" on-Baz.*="baz-event" on-*.bippy="any-bippy"> <Bar /><Baz /><Baz /> </Foo> However, the following code only displays the tooltip. The inner custom components al-tt-translation, and al-tt-input are not initialized. In fact, replacing those two components by a string do not lead to that string being passed in

Ractive.js preventDefault events on event proxies

爱⌒轻易说出口 提交于 2019-12-10 15:11:11
问题 Lets say I have the following code: template <a on-click='myfunc' href="#">Activate!</button> javascript var ractive = new Ractive({ el: output, template: template }); ractive.on( 'myfunc', function ( event ) { alert( 'Hello world!' ); ?????? --> how to prevent the next click event from the a href? }); How can I prevent the next click event from the a href, from the javascript code? I tried event.preventDefault(); but the object has no method 'preventDefault' 回答1: From the docs: event

webpage not loading only in ios9 safari browser

泄露秘密 提交于 2019-12-08 05:47:21
问题 I am facing one problem for rendering some of my webpages in iOS 9 safari browser. these pages are not rendering at all in this browser but the same pages are working fine for desktop and other devices browser including IOS 8 and below. what are the difference between iOS 8 safari and iOS 9 safari? what coud be the solution for this issue? how to debug this issue? do anybody faced this problem already? here we are using ractiveJs frontend templating (legacy version for IE support) and related

How to create Ractive's subcomponents dynamically and change them programmatically

我的未来我决定 提交于 2019-12-01 05:10:01
I can instantiate (sub)components manually using tags, but I don't know how to do it dynamically, or, how to insert and remove different components in the same area using tags. Today I instantiate each (sub)component this way: Ractive.load( '/templates/global/example.html' ).then( function ( Example ) { ractive.components.example = new Example( { el : 'aside' } ); }); But the new (sub)component can't see the data of it's parent instance in mustache, only his own data. Here's a dynamic component: Ractive.components.dynamic = Ractive.extend({ template: '<component/>', components: { component:

RactiveJS and jQuery plugins

橙三吉。 提交于 2019-11-28 19:50:57
I have a form with multiple fields, some of them being for plain text and some of them require plugins for advanced select and upload capability. There are 2 problems with this: ractive needs to parse the template and render it before I can attach the plugins so there is some small delay the second one is that such plugins change the markup around mentioned fields and that cannot work with ractive's generated DOM tree because that markup is out of sync. What is the right approach to solving this problem? I would really like to use ractive for binding all form values and controlling behaviour

RactiveJS and jQuery plugins

前提是你 提交于 2019-11-27 12:32:14
问题 I have a form with multiple fields, some of them being for plain text and some of them require plugins for advanced select and upload capability. There are 2 problems with this: ractive needs to parse the template and render it before I can attach the plugins so there is some small delay the second one is that such plugins change the markup around mentioned fields and that cannot work with ractive's generated DOM tree because that markup is out of sync. What is the right approach to solving