CodeZila
CodeZila

Reputation: 1007

Pass Parameterized md-date-locale attibute to md-datepicker in Angular JS

I am trying to pass JSON string to md-datepicker directive as below:

md-date-locale="{ msgOpenCalendar: 'Open calendar for {{parameter.name}}' }"

md-date-locale attribute is rendered as:

md-date-locale="{ msgOpenCalendar: 'Open calendar for Start Date' }"

But, the aria-label for open calendar button as:

aria-label="Open calendar for {{parameter.name}}"

I need the aria-label to be rendered as 'Open calendar for Start Date'.

Can anyone please suggest? Or is it a bug in md-datepicker directive?

Below is the screenshot: enter image description here

Upvotes: 1

Views: 159

Answers (1)

Pop-A-Stash
Pop-A-Stash

Reputation: 6652

Instead of using double-curly braces in your view, do the concatenation in your controller instead:

$scope.msgOpenCalendarText = "Open calendar for Start Date " + $scope.parameter.name;

Then define your attribute like so:

md-date-locale="{ msgOpenCalendar: msgOpenCalendarText }"

Upvotes: 1

Related Questions