Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move possiblyGetConfigFromAmd method from loadComponent to loadViewModel / loadTemplate #1804

Open
blackChef opened this issue Jun 2, 2015 · 1 comment

Comments

@blackChef
Copy link

viewModel: { my: true, require: './viewModel' }

I'm developing my own component loader. I want to keep the require syntax, and add a flag to indicate that this is my component, so I can do something about it.
But when default loader see require, it loads it, give loadViewModel only the result, thus I can't find my flag.

@mbest
Copy link
Member

mbest commented Nov 14, 2015

When using require, there may not be a single "configuration" of the component. The default loader support two levels of require:

  1. Initial definition: { require: 'componentmodule' }

  2. component module

    {
        template: { require: 'templatemodule' },
        viewModel: { require: 'viewmodelmodule' }
    }
    
  3. template module: '<div>Hello world</div>'

  4. viewmodel module:

    {
        viewModel: function (params) {
            this.value = params.value;
        } 
    }
    

I can across a similar issue that I wanted loadViewModel to have access to other component configuration while researching #1458.

@mbest mbest modified the milestone: Not assigned Dec 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants