javascript - RactiveJS and Stapes model not updating -
i trying create filtering stapes object in ractivejs, seem 2 way binding not responding correctly update.
i can't work out going wrong thought should work without issue, have created code example here:
here's pattern use using computed property filter adapted use case. couldn't stapes object directly usable result, there getallasarray()
seems work:
computed: { filtered: function () { var query = this.get( 'query').trim(), users = this.get( 'users' ); return query ? users.search(query) : users.getallasarray(); } }, data: function () { return { users: usersmodel, query: '' } }
works sub-component pure reactive programming without need event:
<search query="{{query}}" placeholder="search users" />
updated bin here: https://jsbin.com/bomumajagu/edit?html,output
push works against stapes model:
this.get( 'users' ).push( { name: newuser } );
Comments
Post a Comment