0

The fiddle is here

{{Data.x}} does not work. 5 does not display.
{{Data.y.prop1}} works. 6 is displayed

Why is that ? Whats the difference in the way the two properties are referenced ?

TkNeo
  • 415
  • 1
  • 7
  • 16
  • Code in the question and in the fiddle defers. So its unclear what you're asking really. Always try to include relevance code in the question itself. – Bhojendra Rauniyar Jul 08 '16 at 05:09

2 Answers2

0
{{Data.y.prop1}}

Data.y has a sub property which is prop1 and it contain a value which is 6

 {{Data.x}}

In this case Data.x either doesn't have a value at all OR it has a sub property which contains the value like in above mentioned example.

Wcan
  • 840
  • 1
  • 10
  • 31
0

It's because your assigning to the wrong variable. You want to change Trade but you assigned it to the local variable obj.

obj = {
    x: a,
    y: b
}

This should be changed as:

this.Trade = {
   x: a,
   y: b
}

or

this.Trade.x = a;
this.Trade.x = b;

If you wanna know why it worked in y, refer to this thread accepted answer for it will give you a clear answer.

Community
  • 1
  • 1
Adrian
  • 1,597
  • 12
  • 16