当前位置: 首页>>代码示例>>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;未经允许,请勿转载。