Magento2: M2.3.1 template binding not working

Created on 9 Aug 2019  路  20Comments  路  Source: magento/magento2

Preconditions (*)

Magento 2.3.1

Steps to reproduce (*)

  1. Create a new empty module (example Alx_KnockoutExample)
  2. Generate a new route
    (for example by using pestle
    pestle.phar generate_route Alx_KnockoutExample frontend alx_knockout)
  3. Associate a block to the route
    (pestle.phar generate_view Alx_KnockoutExample frontend alx_knockout_index_index Main content.phtml 1column)
  4. Create the file Alx/KnockoutExample/view/frontend/web/template/hello.html
    <p>Hello World</p>
  5. Add the following code in content.phtml
    <div data-bind="template:'Alx_KnockoutExample/hello'"></div>
  6. clean cache and run bin/magento setup:upgrade
  7. Visit the url <magentoBaseUrl>/alx_knockout

Expected result (*)

I should see the message Hello world as defined in the hello.html file

Actual result (*)

The content is empty and inside chrome console I get the following

Uncaught TypeError: Unable to process binding "template: function(){return 'Alx_KnockoutExample/hello' }"
Message: Cannot read property 'name' of undefined
    at RemoteTemplateEngine.makeTemplateSource (engine.js:184)
    at RemoteTemplateEngine.renderTemplate (engine.js:246)
    at executeTemplate (knockout.js:5327)
    at ko.dependentObservable.disposeWhen (knockout.js:5391)
    at Function.evaluateImmediate_CallReadThenEndDependencyDetection (knockout.js:2183)
    at Function.evaluateImmediate_CallReadWithDependencyDetection (knockout.js:2150)
    at Function.evaluateImmediate (knockout.js:2111)
    at Object.ko.computed.ko.dependentObservable (knockout.js:1964)
    at Object.ko.renderTemplate (knockout.js:5383)
    at update (knockout.js:5518)
Ui Confirmed P3 ready for dev Reproduced on 2.3.x S3 Dev.Experience

Most helpful comment

@rani-webkul thanks. I confirm that now the bind is working in that way. So the docs should be updated

All 20 comments

Hi @aleromano89. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [x] Steps to reproduce
  • [x] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@aleromano89 do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

@magento give me 2.3-develop instance

Hi @aleromano89. Thank you for your request. I'm working on Magento 2.3-develop instance for you

Hi @aleromano89, here is your Magento instance.
Admin access: https://i-24087-2-3-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

@magento-engcom-team Can I have the ssh access? thanks

@aleromano89 no. It's not supported

@magento give me 2.3-develop instance

Hi @Stepa4man. Thank you for your request. I'm working on Magento 2.3-develop instance for you

Hi @Stepa4man, here is your Magento instance.
Admin access: https://i-24087-2-3-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

Hi @Stepa4man , how can you reproduce the issue without ssh?

Hi @aleromano89, You don't need.

Hi @Stepa4man. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [x] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [x] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [x] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [x] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [x] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

@Stepa4man Thank you for verifying the issue.

Unfortunately, not enough information was provided to acknowledge ticket. Please consider adding the following:

  • [ ] Add "Component: " label(s) to this ticket based on verification result. If uncertain, you may follow the best guess
  • [ ] Add "Reproduced on " label(s) to this ticket based on verification result

Once all required information is added, please add label "Issue: Confirmed" again.
Thanks!

@Stepa4man Thank you for verifying the issue.

Unfortunately, not enough information was provided to acknowledge ticket. Please consider adding the following:

  • [ ] Add "Component: " label(s) to this ticket based on verification result. If uncertain, you may follow the best guess
  • [ ] Add "Reproduced on " label(s) to this ticket based on verification result

Once all required information is added, please add label "Issue: Confirmed" again.
Thanks!

@Stepa4man Thank you for verifying the issue.

Unfortunately, not enough information was provided to acknowledge ticket. Please consider adding the following:

  • [ ] Add "Reproduced on " label(s) to this ticket based on verification result

Once all required information is added, please add label "Issue: Confirmed" again.
Thanks!

:white_check_mark: Confirmed by @Stepa4man
Thank you for verifying the issue. Based on the provided information internal tickets MC-19127 were created

Issue Available: @Stepa4man, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._

Hi @aleromano89, You don't need.

Ok @Stepa4man. Can you tell me what are the steps to do? thanks

@aleromano89, nobody has access to the codebase. So the only way, for now, is to check it locally at the own machine.

I think we need to bind like <div data-bind="template:{name:'Webkul_Pos/hello',data:{}}"></div>
it's working fine for me..

@rani-webkul thanks. I confirm that now the bind is working in that way. So the docs should be updated

Was this page helpful?
0 / 5 - 0 ratings