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

Import view model #1649

merged 4 commits into from Apr 29, 2015


None yet
1 participant

daffl commented Apr 28, 2015

This pull request allows to import a child components view model (or its properties) into a named property of parent scope. For example:

    tag: 'import-scope',
    template: can.stache('Hello {{name}}'),
    viewModel: {
        name: 'David',
        age: 7

    tag: 'import-parent',
    template: can.stache('<import-scope [test]="{this}"></import-scope> Imported: {{}} {{test.age}}')

Will import the import-scope components scope into the test variable. A template like

can.stache('<import-scope [test]="{name}"></import-scope> Imported: {{test}}')

Will import the name property into the test parent scope property.

daffl added a commit that referenced this pull request Apr 29, 2015

@daffl daffl merged commit c1d789d into minor Apr 29, 2015

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
continuous-integration/travis-ci/push The Travis CI build passed

@daffl daffl deleted the import-view-model branch Apr 29, 2015

@daffl daffl added this to the 2.3.0 milestone Apr 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment