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

Re-load Component constructor

$
0
0

Hi all, new to this forum as I recently started working with Ember Octane. Have a question about components

I have a UserResults component that’s embedded in Enterprise controller. The enterprise model (contains user lists) gets passed down to the component. The component then renders a list of users

user-results.js:

export default class UserResultsComponent extends Component {

    constructor(owner, args){
      super(owner, args);
      this.enterpriseModel = args.enterpriseModel;
      this.userResults = this.enterpriseModel.users || [];
      }
}

user-results.hbs:

{{#each this.userResults as |user|}}
   {{user}}
{{/each}}

This works as expected. My question is… the constructor runs only once when the component is first rendered. When I navigate away from the component to another page and then return, the component remains rendered and the constructor is not called.

Is there any way I can make the constructor to fire again? The reason is I want the constructor to carry out some logic every time .

If the question is too vague, please let me know, I can provide more detail.

Thanks

5 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 4870

Trending Articles