本文整理汇总了TypeScript中angular.equals函数的典型用法代码示例。如果您正苦于以下问题:TypeScript equals函数的具体用法?TypeScript equals怎么用?TypeScript equals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了equals函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: equals
equals(other: VendorItem) {
// Defs can be ref-compared
return this.vendorItemDef === other.vendorItemDef &&
this.canPurchase === other.canPurchase &&
// Deep equals
equals(this.saleItem, other.saleItem);
}
示例2: function
const updateVisibility = function() {
const rect = element[0].getBoundingClientRect();
const newVisibility = {top: 'visible', bottom: 'visible', left: 'visible', right: 'visible'};
if (rect.bottom < offset.top) {
newVisibility.top = 'hidden';
} else if (rect.top < offset.top) {
newVisibility.top = 'partial';
}
if (rect.top > $window.innerHeight - offset.bottom) {
newVisibility.bottom = 'hidden';
} else if (rect.bottom > $window.innerHeight - offset.bottom) {
newVisibility.bottom = 'partial';
}
if (rect.right < offset.left) {
newVisibility.left = 'hidden';
} else if (rect.left < offset.left) {
newVisibility.left = 'partial';
}
if (rect.left > $window.innerWidth - offset.right) {
newVisibility.bottom = 'hidden';
} else if (rect.right > $window.innerWidth - offset.right) {
newVisibility.bottom = 'partial';
}
// return if unchanged
if (angular.equals(oldVisibility, newVisibility)) return;
oldVisibility = newVisibility;
scope.$evalAsync(attrs.onVisibilityChanged, {$visibility: newVisibility});
};
示例3: function
Array.prototype['indexOfObject'] = function(obj) {
for(var i = 0; i < this.length; i++){
if(angular.equals(this[i], obj)){
return i;
}
};
return -1;
}
示例4: function
return function(){
var oldPages = currentPages;
var newPages = self.generatePagesArray(self.page(), self.total(), self.count());
if (!ng1.equals(oldPages, newPages)){
currentPages = newPages;
ngTableEventsChannel.publishPagesChanged(this, newPages, oldPages);
}
}
示例5: expect
dataTableSettings.retrieveRowsAndColumnsFromUrl(modelName, tree, currId).then((responseData: IRowsColsResponse) => {
expect(responseData.cols.length > 0).toBeTruthy();
expect(responseData.rows.length > 0).toBeTruthy();
expect(angular.equals(
responseData.settings,
{perpage: 20, current: 1, items: 6, total: 1}
)).toBeTruthy();
done();
});
示例6: it
it('should generate full config', () => {
expect(
angular.equals(
DataTableSettingsService.generateConfig(modelName, tree, currId),
{
model: modelName,
model_name: modelName,
active_tree: tree,
model_id: currId,
parent_id: currId
}
)
).toBeTruthy();
});
示例7:
angular.forEach(items, (item: any)=> {
var valueToCheck, isDuplicate = false;
for (var i = 0; i < newItems.length; i++) {
if (angular.equals(extractValueToCompare(newItems[i]), extractValueToCompare(item))) {
isDuplicate = true;
break;
}
}
if (!isDuplicate) {
newItems.push(item);
}
});
示例8: function
const resizeHandler = function() {
const newSize = {
height: element[0].offsetHeight,
width: element[0].offsetWidth,
scrollHeight: element[0].scrollHeight,
scrollWidth: element[0].scrollWidth,
};
// return if unchanged
if (angular.equals(newSize, oldSize)) return;
oldSize = newSize;
scope.$evalAsync(attrs.onResized, {$size: newSize});
};
示例9: function
const resizeHandler = function(e) {
const newSize = {
height: element[0].offsetHeight,
width: element[0].offsetWidth
};
// return if unchanged
if (angular.equals(size, newSize)) {
return;
}
// copy object
angular.copy(newSize, size);
// call apply if this function has been called as an event handler
if (e) {
scope.$apply();
}
};
示例10: function
const positionHandler = function(e) {
const rect = element[0].getBoundingClientRect();
// angular.copy and _.clone do *not* work here -> copy manually
const properties =
['bottom', 'height', 'left', 'right', 'top', 'width'];
const newPosition = {};
angular.forEach(properties, function(property) {
newPosition[property] = rect[property];
});
// return if unchanged
if (angular.equals(position, newPosition)) {
return;
}
// copy object
angular.copy(newPosition, position);
// call apply if this function has been called as an event handler
if (e) {
scope.$apply();
}
};