ractivejs - Ractive computed attributes returned in get() -
ref this jsfiddle
html:
<main /> <div id='result' />
code:
window.ractive = new ractive({ el: 'main', template: '<p>a thing called {{thing}}</p>', computed: { thing : function(){return "kablooie"} } }); $('#result').html(json.stringify(ractive.get()))
the ractive.get() here does return value of attribute "thing". though docs computed attributes not returned get().
is intentional behaviour or bug?
in edge ractive (will 0.8) using, added computed , mapped properties root via ractive.get()
feature request.
see this issue current proposal able root data object via ractive.get('.')
, mean:
window.ractive = new ractive({ el: 'main', data: { foo: 'foo' }, template: '<p>a thing called {{thing}}</p>', computed: { thing : function(){return "kablooie"} } }); console.log( json.stringify( ractive.get() ) ); // { foo: 'foo', thing: 'kablooie' } console.log( json.stringify( ractive.get('.') ) ); // { foo: 'foo' }
Comments
Post a Comment