Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4838

Is there a way to a change in a tracked property fire a function

$
0
0

@pabloascarza wrote:

So im been trying ember octane and i have this article page /articles/:id wich model i load in the route is only the id, and in the template i have a component (glimmer one) like this <Article articleId=@model /> this Article component is the one who fech the data in the constructor and show it using tracked properties, but here is the problem in this template (the route template) i also have a linkTo related articles <LinkTo @route="articles" @model="{{relatedId}}">Related Article</LinkTo> when i click to this article the i was specting the Article component to re-render call again the contructor and fetch the data using the new id pased in the args, but this dosent happend. So i realize that with the didReceiveAttrs hook i can do this easily in ember legacy component, but with glimmer components i dont have this hook and i don’t see a nice way to do this (i thought observers, some kind of async computeds, replace the linkTo with an action that later redirect and more), anyone know a nice way to solve this. Please dont tell me to fetch the data in the route, i really don’t want to do that.

Posts: 5

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 4838

Trending Articles