question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: this.get('content') returns empty string when trying to add custom component type

See original GitHub issue

Version: 0.16.18

Are you able to reproduce the bug from the demo?

>>> Demo <<<

[ X ] Yes [ ] No

What is the expected behavior? Expecting this.get(‘content’) in the context of the model while creating a new component type (extending the default component type) should return the children as HTML.

Describe the bug detailed Not sure if it’s a but or I’m doing something wrong however in all of the examples I’ve come across in other issues it seems like this.get('content') should return it’s children’s HTML but instead it returns an empty string.

What is the current behavior? It only returns the text content in the component if there is any but if there are children components it will not return them.

Are you able to attach screenshots, screencasts or a live demo?

demo

[ X ] Yes (attach) [ ] No

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
artfcommented, Aug 27, 2020

No, content property is only used in components like Text/Textnode. Replace your this.get('content') with this.components().map(comp => comp.toHTML())

0reactions
Joshmamroudcommented, Sep 1, 2020

Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

$this->getChildHtml() returns empty string - Stack Overflow
Try wrapping the var_dump() with html you can see. Then use your browser and inspect the elements. The contents are probably inside.
Read more >
Computed field goes default (empty string) when calling update
Hello ! I've recently been developing a custom provider for my own API and went through a problem that I can't overcome.
Read more >
ASP.NET Core Blazor forms and input components
Learn how to use forms with field validation and built-in input components in Blazor.
Read more >
HTTP Tests - Laravel - The PHP Framework For Web Artisans
The get method makes a GET request into the application, while the assertStatus method asserts that the returned response should have the given...
Read more >
Object.prototype.toString() - JavaScript - MDN Web Docs
The toString() method returns a string representing the object. This method is meant to be overridden by derived objects for custom type ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found