Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manually trigger property change in ember.js

I have a component with a property 'viewBox' that stores a POJO, with an observer on this property. I want to be able to modify the properties of this viewBox without using set and then manually trigger a change on the viewBox. Is this possible in ember.js ?

like image 389
J. Barca Avatar asked Apr 06 '15 17:04

J. Barca


People also ask

What is @tracked in Ember?

In Ember, to declare a property as trackable, we decorate it with @tracked. When this state is updated, dependent parts of your system will re-run. Dynamic state, such as arguments passed to components on this. args, are also auto-tracked.

What is alias in Ember?

alias (dependentKey) ComputedProperty public returns. ComputedProperty. computed property which creates an alias to the original value for property. Creates a new property that is an alias for another property on an object. Calls to get or set this property behave as though they were called on the original property.

What is tracked property?

Tracked properties replace computed properties. Unlike computed properties, which require you to annotate every getter with the values it depends on, tracked properties only require you to annotate the values that are trackable, that is values that: Change over the lifetime of their owner (such as a component) and.

What is octane ember?

Ember Octane describes a set of new features that, when taken together, represent a foundational improvement to the way you use Ember. It has modern, streamlined components and state management that make it fun to build web applications.


1 Answers

You can use the notifyPropertyChange method on Ember.Observable to let Ember know a property has been changed through manual assignment.

like image 88
Elad Shahar Avatar answered Sep 21 '22 17:09

Elad Shahar