Polymer "property-changed" event not fired when element property is set

Tony Bogdanov

I have a Polymer element (cw-app) property declared like this:

test: {
  type: String,
  notify: true,
  value: 'default test value'
}

As you can see it has a declared default value of default test value.

Initially, when the element is added to the page like this: <cw-app></cw-app> a corresponding test-changed event is being fired.

However, if I add the element and set a value for the property like this: <cw-app test="new value"></cw-app>, then no test-changed event is being fired initially.

Is this a desired behavior and has it been documented anywhere?

http://jsbin.com/xazaqozani/edit?html,console,output

Supersharp

I would say it's the expected behaviour:

  • In the first case the value of test is changed from null (no test attribute set) to "default test value" so the changed event is fired.

  • In the second case the value is set to "new value" at creation time. It's not changed so there's no changed event.

See a discussion on Polymer issue page on GitHub:

If you declare <x-foo id="foo" value="foo"></x-foo> the value foo will be assumed to be coming 'from above', t.i. from a user of the element. During config phase Polymer will not echo such data changes upwards. (Assuming the producer of the value/user of the element already has knowledge of this change.)

On the other side, if you <x-foo id="bar"></x-foo> the default value will propagate upwards. For the same reasons, x-foo produced this value, and the user of x-foo has otherwise no knowledge about this. T.i. the default value is not coming from above(, but from x-foo).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

enter press doesn't raise property changed event wpf

From Dev

Triggering RaisePropertyChanged when Sub Property is changed - MvvmCross

From Dev

Polymer.dart <property>Changed Functionality Not Working With Map

From Dev

How to get old entity value in @HandleBeforeSave event to determine if a property is changed or not?

From Dev

Polymer click event is not fired

From Dev

StackPanel visibility not updated when dependency property changed

From Dev

Button Command CanExecute not called when property changed

From Dev

WPF `ComboBox` ItemsSource property is changed the SelectedItem property is being set to null

From Dev

Polymer element doesn't trigger the "on-<property>-changed" event when property changes

From Dev

polymer 1.0 event when element appears on page

From Dev

C# XAML Databinding has no effect when property is changed

From Dev

Execute method in viewmodel when property changed

From Dev

Polymer IronResizableBehavior iron-resize event not fired when "resizable" element is hidden/un-hidden as described in docs

From Dev

Re-render Angular2 component when property is changed

From Dev

Exception "The operation completed successfully" raising property changed event

From Dev

WPF Event Not Raised when Dependency Property Changed

From Dev

Data Binding, Property Changed Event

From Dev

How to fire Property Changed Event when it's not actually changing

From Dev

Prevent triggering windows resize event when css property is changed using jquery

From Dev

Triggering RaisePropertyChanged when Sub Property is changed - MvvmCross

From Dev

View not updating when property is changed by event from another thread

From Dev

Polymer.dart <property>Changed Functionality Not Working With Map

From Dev

Raise Property Changed event from other class

From Dev

MVVM object fire property changed event when a field is changed

From Dev

Capture when disabled property is changed (IE8 compatible)

From Dev

Polymer element doesn't trigger the "on-<property>-changed" event when property changes

From Dev

polymer 1.0 event when element appears on page

From Dev

Property Changed event within class

From Dev

MVVM View binding does not update even with Property Changed fired when update happens from an event handler

Related Related

  1. 1

    enter press doesn't raise property changed event wpf

  2. 2

    Triggering RaisePropertyChanged when Sub Property is changed - MvvmCross

  3. 3

    Polymer.dart <property>Changed Functionality Not Working With Map

  4. 4

    How to get old entity value in @HandleBeforeSave event to determine if a property is changed or not?

  5. 5

    Polymer click event is not fired

  6. 6

    StackPanel visibility not updated when dependency property changed

  7. 7

    Button Command CanExecute not called when property changed

  8. 8

    WPF `ComboBox` ItemsSource property is changed the SelectedItem property is being set to null

  9. 9

    Polymer element doesn't trigger the "on-<property>-changed" event when property changes

  10. 10

    polymer 1.0 event when element appears on page

  11. 11

    C# XAML Databinding has no effect when property is changed

  12. 12

    Execute method in viewmodel when property changed

  13. 13

    Polymer IronResizableBehavior iron-resize event not fired when "resizable" element is hidden/un-hidden as described in docs

  14. 14

    Re-render Angular2 component when property is changed

  15. 15

    Exception "The operation completed successfully" raising property changed event

  16. 16

    WPF Event Not Raised when Dependency Property Changed

  17. 17

    Data Binding, Property Changed Event

  18. 18

    How to fire Property Changed Event when it's not actually changing

  19. 19

    Prevent triggering windows resize event when css property is changed using jquery

  20. 20

    Triggering RaisePropertyChanged when Sub Property is changed - MvvmCross

  21. 21

    View not updating when property is changed by event from another thread

  22. 22

    Polymer.dart <property>Changed Functionality Not Working With Map

  23. 23

    Raise Property Changed event from other class

  24. 24

    MVVM object fire property changed event when a field is changed

  25. 25

    Capture when disabled property is changed (IE8 compatible)

  26. 26

    Polymer element doesn't trigger the "on-<property>-changed" event when property changes

  27. 27

    polymer 1.0 event when element appears on page

  28. 28

    Property Changed event within class

  29. 29

    MVVM View binding does not update even with Property Changed fired when update happens from an event handler

HotTag

Archive