0

While I was working with a dx-calendar component from DevExtreme, I face an issue. I just wanted to pass 1 to firstDayOfWeek of that component in order to set Monday as the first day of the week. So I tried:

<dx-calendar firstDayOfWeek="1" />

But it didn't work and the solution was:

<dx-calendar [firstDayOfWeek]="1" />

I thought they both are passing 1 to the component, but the behavior was different.

Related Question here

Ever Dev
  • 1,882
  • 2
  • 14
  • 34

2 Answers2

1

I found the differences between them. So the first one is passing a string "1" to the component and the second one was passing a number 1 to the component.

When we use [] for the attributes in Angular, the value is a kind of expression, and what's actually inputted to the component eval("1") that is 1.

Ever Dev
  • 1,882
  • 2
  • 14
  • 34
1

This represents that you assign string value "1" to firstDayOfWeek prop.

<dx-calendar firstDayOfWeek="1" />

This represents that you assign int value 1 to firstDayOfWeek prop. ([] means assigning javascript value to firstDayOfWeek. So 1 is assigned as int value.)

<dx-calendar [firstDayOfWeek]="1" />
Derek Wang
  • 10,098
  • 4
  • 18
  • 39