Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Creating Reusable Components

$
0
0
If you call ContentPanel({}) more than once in your app <content-panel> will be defined as last run result.

If your planning to call it once, if I understand your intention correctly you are trying to implement some kind of component inheritance, but to me it is quite wierd way to do this (it may seem to be neat and sophisticated - but it is not simple, usually this is bad).

I think better way is to create a wrapper component for each kind of app:

        can.Component.extend({
            tag: 'shares-content-panel',
            template: '<content-panel app-title="{{appTitle}}"><shares-settings></shares-settings></content-panel>,
            scope: {
                  appTitle: 'cloudarray.sharesSettings.appTitle'
            }
        });

You can even try to use inheritance mechanics of can.Contruct to implement extended component, though while it can work good for can.Control/can.Map to me it is a bad way to go with for can.Component.

Well perhaps bitovi team has another opinion.

Viewing all articles
Browse latest Browse all 3491

Trending Articles