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.

Default properties values are not working

See original GitHub issue

Description

Default values are not being applied when a property has one specified and its corresponding attribute is not defined.

Live Demo

https://lit-element-example-km85zd.stackblitz.io

Steps to Reproduce

  1. Create my-element
  2. Define a property with a default value
  3. Use the default value in the element’s template
  4. Append my-element to document.body

Expected Results

The default value should be rendered

Actual Results

The default value is not rendered (nor is it passed to _render in the props object)

Browsers Affected

  • Chrome – other browsers were not tested

Versions

  • lit-element: v0.5.2
  • webcomponentsjs: v2.0.2
  • polymer: v3.0.2

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:8

github_iconTop GitHub Comments

8reactions
jimsimoncommented, Jun 24, 2018

That makes sense, I’d just add that it’s not super clear from the README and it’s easy to make assumptions since this element is part of the Polymer project. Would it make sense to add some sort of feature comparison to PolymerElement in the README?

0reactions
hzmsrvcommented, Jul 25, 2020

how to solve somehow we want to get values from an element prototype? when we get value from “litelemnt.prototype.accessKey” the browser gets an error and stops running the code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Default properties values are not working · Issue #114 - GitHub
Description. Default values are not being applied when a property has one specified and its corresponding attribute is not defined.
Read more >
Spring @Value annotated method, use default value when ...
Problem. Even if I set default values to field itself I get exception when .properties file is not present: org.springframework.beans.
Read more >
Using Spring @Value with Defaults - Baeldung
A quick and practical guide to setting default values when using the @Value annotation in Spring.
Read more >
Default property values not working in SPFx web part
I have 3 web part properties set up in my spfx web part. However it is not showing the default values I have...
Read more >
Setting the default value of Infotable property does not work
Solved: Hi, I have a infotable property in a Thing (Generic Thing), and I have set a default value to that Infotable property,...
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