Skip to content

Commit 9f4ccc6

Browse files
committed
fix for minIndex/maxIndex descriptors
1 parent f9654c9 commit 9f4ccc6

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

src/ui-scroll.js

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -542,25 +542,31 @@ angular.module('ui.scroll', [])
542542
}
543543
}
544544

545-
Object.defineProperty(_datasource, 'minIndex', {
546-
set: function (value) {
547-
this._minIndex = value;
548-
onDatasourceMinIndexChanged(value);
549-
},
550-
get: function get() {
551-
return this._minIndex;
552-
}
553-
});
545+
let minIndexDesc = Object.getOwnPropertyDescriptor(_datasource, 'minIndex');
546+
if(!minIndexDesc || (!minIndexDesc.set && !minIndexDesc.get)) {
547+
Object.defineProperty(_datasource, 'minIndex', {
548+
set: function (value) {
549+
this._minIndex = value;
550+
onDatasourceMinIndexChanged(value);
551+
},
552+
get: function get() {
553+
return this._minIndex;
554+
}
555+
});
556+
}
554557

555-
Object.defineProperty(_datasource, 'maxIndex', {
556-
set: function (value) {
557-
this._maxIndex = value;
558-
onDatasourceMaxIndexChanged(value);
559-
},
560-
get: function get() {
561-
return this._maxIndex;
562-
}
563-
});
558+
let maxIndexDesc = Object.getOwnPropertyDescriptor(_datasource, 'maxIndex');
559+
if(!maxIndexDesc || (!maxIndexDesc.set && !maxIndexDesc.get)) {
560+
Object.defineProperty(_datasource, 'maxIndex', {
561+
set: function (value) {
562+
this._maxIndex = value;
563+
onDatasourceMaxIndexChanged(value);
564+
},
565+
get: function get() {
566+
return this._maxIndex;
567+
}
568+
});
569+
}
564570

565571
return _datasource;
566572
})();

0 commit comments

Comments
 (0)