mikeric / rivets

Lightweight and powerful data binding.
http://rivetsjs.com
MIT License
3.23k stars 310 forks source link

component #709

Closed ericxin1982 closed 7 years ago

ericxin1982 commented 7 years ago

Hi Team,

So just wondering whether there is a full example for component where I can learn?

Thanks Eric Xin

Namek commented 7 years ago

Hi, does the Guide misguide you or just want to see a plunker? http://rivetsjs.com/docs/guide/#components

ericxin1982 commented 7 years ago

Hi, if there is an available jsfiddle would be great, I can have an online try. I am not sure plunker means. And I do not know what it means as below: return JST['todos/todo-item']

At 2017-03-07 22:47:42, "Namek" notifications@github.com wrote:

Hi, does the Guide misguide you or just want to see a plunker? http://rivetsjs.com/docs/guide/#components

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Namek commented 7 years ago

In the JST part you simply provide a template. This has to be a string containing HTML that uses normal rivets bindings etc. In my case it is:

template: function() {
    return $id('member-list-template').innerHTML
},

and the template is injected into <head> part of website by PHP:

<script type="text/html" id="member-list-template">{{ View::make('club/member-list') }}</script>
ericxin1982 commented 7 years ago

would you mind giving me the a whole picture, I am confused. @Namek

ericxin1982 commented 7 years ago

Hi Namek,

Would you please give me these two html files, so I can have a better understanding. I am too new to this part.

Thanks Eric Xin

At 2017-03-07 23:05:44, "Namek" notifications@github.com wrote:

In the JST part you simply provide a template. This has to be a string containing HTML that uses normal rivets bindings etc. In my case it is:

template:function() { return$id('member-list-template').innerHTML },

and the template is injected into part of website by PHP:

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Namek commented 7 years ago

Hi, sorry fo taking so long. You may learn about components here: https://www.namekdev.net/2017/05/binding-with-rivets-js-details-and-tricks/

or go straight to live example: http://plnkr.co/edit/gXNQuwXDuJHUHvYsppyh?p=preview

The live example was already mentioned between issues so you didn't dig well enough: https://github.com/mikeric/rivets/issues/691

Please consider closing this issue.

benadamstyles commented 7 years ago

Looks like @Namek has replied fully, please reopen if you need.