Docs

Everything You Need to Know

Components

Intro

As useful as Views are, sometimes you need a view that you can reuse in different parts of your app. ChocolateChip-UI's $.Component method lets you create reusable views. Components support all the same features as Views - templates, events, startFromIndex, models, etc. The only difference between a component and a view is how you access them.

When you setup a component, you give it a name. Say we make a component that we name Widget. After defining the component with that name, we would access it like this:

// Create an instance of our component:
var widget1 = $.Widget();
widget.setElement('#widget1');
widget.render(data);

For complete details on how to define and use components, please read this section.