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

Noob - if condition doesn't work

$
0
0

@FlorianKrippner wrote:

Hej, i have the following problem:

i have a .hbs file with this code:

{{#if this.showRamCpuSettings}}
test
{{else}}
lol
{{/if}}

and in the route i have the following code:

import Route from '@ember/routing/route';
import {
  set
} from '@ember/object';

export default Route.extend({

  showRamCpuSettings: false,
  queryParams: {
    widget: ''
  },
  model(params) {

    if (params.widget == 'ramcpu') {
      set(this, "showRamCpuSettings", true);
      console.log("showRamCpuSettings: " + this.showRamCpuSettings); //output: showRamCpuSettings: true
    }

  },

  actions: {
    resetRoute() {
      const routeName = this.get('widgetsettings');

    }
  },
});

goal: if i get to the page i will parse a widgetName and i want to show different components at the end depends on the queryparams.

the console.log says to me that this.showRamCpuSettings is true. but the #if still shows me only “lol” (else). do someone know what i am doing wrong ?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4830

Trending Articles