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

Commit

Permalink
fix(calendar): Make calendar directive IDs unique
Browse files Browse the repository at this point in the history
Prefix all calendar id attributes with the directive scope $id. This
makes it possible to include multiple calendar instances on the same
page.
  • Loading branch information
Michael Chen authored and jelbourn committed Aug 13, 2015
1 parent b789eef commit 406ffe6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/calendar/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
// TODO(jelbourn): make aria-live element visibly hidden (but still present on the page).

function calendarDirective() {
// Generate a unique ID for each instance of the directive.
var directiveId = 0;

return {
template:
'<div>' +
Expand All @@ -48,6 +51,7 @@
link: function(scope, element, attrs, controllers) {
var ngModelCtrl = controllers[0];
var mdCalendarCtrl = controllers[1];
mdCalendarCtrl.directiveId = directiveId++;
mdCalendarCtrl.configureNgModel(ngModelCtrl);
}
};
Expand Down

0 comments on commit 406ffe6

Please sign in to comment.