Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 406ffe6

Browse files
Michael Chenjelbourn
authored andcommitted
fix(calendar): Make calendar directive IDs unique
Prefix all calendar id attributes with the directive scope $id. This makes it possible to include multiple calendar instances on the same page.
1 parent b789eef commit 406ffe6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/components/calendar/calendar.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
// TODO(jelbourn): make aria-live element visibly hidden (but still present on the page).
3131

3232
function calendarDirective() {
33+
// Generate a unique ID for each instance of the directive.
34+
var directiveId = 0;
35+
3336
return {
3437
template:
3538
'<div>' +
@@ -48,6 +51,7 @@
4851
link: function(scope, element, attrs, controllers) {
4952
var ngModelCtrl = controllers[0];
5053
var mdCalendarCtrl = controllers[1];
54+
mdCalendarCtrl.directiveId = directiveId++;
5155
mdCalendarCtrl.configureNgModel(ngModelCtrl);
5256
}
5357
};

0 commit comments

Comments
 (0)