本文整理汇总了TypeScript中underscore.UnderscoreStatic.intersection方法的典型用法代码示例。如果您正苦于以下问题:TypeScript UnderscoreStatic.intersection方法的具体用法?TypeScript UnderscoreStatic.intersection怎么用?TypeScript UnderscoreStatic.intersection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类underscore.UnderscoreStatic
的用法示例。
在下文中一共展示了UnderscoreStatic.intersection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
/**
* Constructs a {@code ConnectionDialog}.
*/
constructor($scope: any, $mdDialog: angular.material.IDialogService, isNew: any, connectionDataModel: any, source: any, dest: any) {
$scope.isValid = false;
$scope.connectionDataModel = angular.copy(connectionDataModel);
$scope.source = angular.copy(source);
$scope.dest = angular.copy(dest);
$scope.joinTypes = [{name: "Inner Join", value: "INNER JOIN"}, {name: "Left Join", value: "LEFT JOIN"}, {name: "Right Join", value: "RIGHT JOIN"}];
$scope.isNew = isNew;
if (isNew) {
//attempt to auto find matches
let sourceNames: any = [];
let destNames: any = [];
angular.forEach(source.data.nodeAttributes.attributes, function (attr: any) {
sourceNames.push(attr.name);
});
angular.forEach(dest.data.nodeAttributes.attributes, function (attr: any) {
destNames.push(attr.name);
});
let matches = _.intersection(sourceNames, destNames);
if (matches && matches.length && matches.length > 0) {
let col = matches[0];
if (matches.length > 1) {
if (matches[0] == 'id') {
col = matches[1];
}
}
$scope.connectionDataModel.joinKeys.sourceKey = col;
$scope.connectionDataModel.joinKeys.destKey = col;
$scope.connectionDataModel.joinType = "INNER JOIN"
}
}
$scope.onJoinTypeChange = function () {
// .log('joinType changed')
};
$scope.hide = function () {
$mdDialog.hide();
};
$scope.validate = function () {
$scope.isValid =
$scope.connectionDataModel.joinType != '' && $scope.connectionDataModel.joinType != null && $scope.connectionDataModel.joinKeys.sourceKey != null
&& $scope.connectionDataModel.joinKeys.destKey != null;
};
$scope.save = function () {
connectionDataModel.name = $scope.connectionDataModel.name;
connectionDataModel.joinType = $scope.connectionDataModel.joinType;
connectionDataModel.joinKeys = $scope.connectionDataModel.joinKeys;
$mdDialog.hide('save');
};
$scope.cancel = function () {
$mdDialog.hide('cancel');
};
$scope.delete = function () {
$mdDialog.hide('delete');
};
$scope.validate();
}