You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maxime Séguin edited this page May 19, 2015
·
1 revision
A component is any small part of your project: It can be a page, a dialogue, a utility JavaScript file or a small reusable UI part. It can contain html (view), JavaScript (view model, Knockout binding handler, utility library), images, styles (.less), etc. For this one, we will create a "special title" that will append "special" to a title passed as a parameter.
Type this line in the system console:
yo koco:component special-title
home being the name of the page. By contention, this will create a folder "special-title" in the "components" folder of your koco project. Normally (except "html only" components), a component consists of a "view model" (JavaScript) file and a view (html) file. A component is nothing more than a KnockoutJS Component. See KnockoutJS Components for more information.
The generator will ask for:
Is the component html only: If the component has no specific behaviour other than displaying some data, you can choose to make it "html only". This will create only one file (html) instead of the normal 2 files (view model & view)
press enter to select default (No)
This will also register the component in the "components.js" file.