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

Fix use with md-virtual-repeat (and other directives that recycle rep… #475

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions dist/md-data-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ function mdRow() {

angular.module('md.data.table').directive('mdSelect', mdSelect);

function mdSelect($compile, $parse) {
function mdSelect($compile) {

// empty controller to bind scope properties to
function Controller() {
Expand All @@ -893,7 +893,6 @@ function mdSelect($compile, $parse) {
function postLink(scope, element, attrs, ctrls) {
var self = ctrls.shift();
var tableCtrl = ctrls.shift();
var getId = $parse(attrs.mdSelectId);

self.id = getId(self.model);

Expand Down Expand Up @@ -931,6 +930,8 @@ function mdSelect($compile, $parse) {
return false;
}

self.id = getId(self.model);

if(self.id) {
return tableCtrl.$$hash.has(self.id);
}
Expand Down Expand Up @@ -1011,7 +1012,13 @@ function mdSelect($compile, $parse) {
return tableCtrl.$$rowSelect;
}

function getId(model) {
return model ? model[attrs.mdSelectId] : undefined;
}

function onSelectChange(selected) {
self.id = getId(self.model);

if(!self.id) {
return;
}
Expand Down Expand Up @@ -1092,7 +1099,8 @@ function mdSelect($compile, $parse) {
};
}

mdSelect.$inject = ['$compile', '$parse'];
mdSelect.$inject = ['$compile'];


angular.module('md.data.table').directive('mdTable', mdTable);

Expand Down
Loading