本文整理匯總了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();
}