當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript UnderscoreStatic.intersection方法代碼示例

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

    }
開發者ID:prashanthc97,項目名稱:kylo,代碼行數:72,代碼來源:connection-dialog.component.ts


注:本文中的underscore.UnderscoreStatic.intersection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。