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


TypeScript angular.copy函數代碼示例

本文整理匯總了TypeScript中angular.copy函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript copy函數的具體用法?TypeScript copy怎麽用?TypeScript copy使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了copy函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

 return query.then($scope.transformToSegments(true)).then(results => {
   if (segment.type === 'key') {
     results.splice(0, 0, angular.copy($scope.removeDimSegment));
   }
   return results;
 });
開發者ID:grafana,項目名稱:grafana,代碼行數:6,代碼來源:query_parameter_ctrl.ts

示例2: function

      return function (scope: Scope, iElement: any, iAttrs: any, controller: any) {
        let domElement = iElement[0];

        /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         * internal model
         * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

        let optionsAlreadyRead: IPromise<void>;
        let ngModelAlreadyRead: boolean = false;

        let hasBeenOpened = false;
        let internalOptions: InternalOption[] = [];
        let internalOptionsMap = {};
        let optionsFiltered: InternalOption[] = [];

        scope.options = {
          visible: []
        };

        scope.filter = {
          values: {}
        };

        scope.config = angular.copy(w11kSelectConfig.instance);

        // marker to read some parts of the config only once
        let configRead = false;

        scope.$watch(
            function () {
              return configExpParsed(scope.$parent);
            },
            function (newConfig) {
              if (angular.isArray(newConfig)) {
                w11kSelectHelper.extendDeep.apply(w11kSelectHelper, [scope.config].concat(newConfig));
                applyConfig();
              } else if (angular.isObject(newConfig)) {
                w11kSelectHelper.extendDeep(scope.config, newConfig);
                applyConfig();
              }
            },
            true
        );

        function applyConfig () {
          optionsAlreadyRead.then(function () {
            checkSelection();
            updateNgModel();
            checkConfig(scope.config, setViewValue);
            controller.$validate();
          });

          if (!configRead) {
            updateStaticTexts();
            configRead = true;
          }
        }

        function updateStaticTexts () {
          if (scope.config.filter.select.active && scope.config.filter.select.text !== null && typeof(scope.config.filter.select.text) !== 'undefined') {
            let selectFilteredButton = domElement.querySelector('.select-filtered-text');
            selectFilteredButton.textContent = scope.config.filter.select.text;
          }

          if (scope.config.filter.deselect.active && scope.config.filter.deselect.text !== null && typeof(scope.config.filter.deselect.text) !== 'undefined') {
            let deselectFilteredButton = domElement.querySelector('.deselect-filtered-text');
            deselectFilteredButton.textContent = scope.config.filter.deselect.text;
          }

          if (scope.config.header.placeholder !== null && typeof(scope.config.header.placeholder) !== 'undefined') {
            let headerPlaceholder = domElement.querySelector('.header-placeholder');
            headerPlaceholder.textContent = scope.config.header.placeholder;
          }
        }

        function checkSelection () {
          if (scope.config.multiple === false) {
            let selectedOptions: InternalOption[] = internalOptions.filter(
                (option) => option.state === OptionState.selected
            );

            if (selectedOptions.length > 0) {
              setSelected(selectedOptions, false);
              selectedOptions[0].state = OptionState.selected;
            }
          }
        }

        /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         * dropdown
         * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

        let domDropDownMenu = domElement.querySelector('.dropdown-menu');
        let domDropDownContent = domElement.querySelector('.dropdown-menu .content');
        let domHeightAdjustContainer = w11kSelectHelper.getParent(iElement, '.w11k-select-adjust-height-to');
        let domHeaderText = domElement.querySelector('.header-text');

        function onEscPressed (event) {
          if (event.keyCode === 27) {
            if (scope.dropdown.close) { // check is for ts only
//.........這裏部分代碼省略.........
開發者ID:w11k,項目名稱:w11k-select,代碼行數:101,代碼來源:w11k-select.directive.ts

示例3: copy

 finalItems[type.toLowerCase()] = items.map((i) => {
   const copiedItem = copy(i);
   copiedItem.equipped = false;
   return copiedItem;
 });
開發者ID:delphiactual,項目名稱:DIM,代碼行數:5,代碼來源:auto-loadouts.ts

示例4: calculateFakeIds

 res => {
     arviointiasteikot = res;
     calculateFakeIds();
     $scope.arviointiasteikot = angular.copy(arviointiasteikot);
     Notifikaatiot.onnistui("arviointiasteikkojen-päivitys-onnistui");
 },
開發者ID:Opetushallitus,項目名稱:eperusteet,代碼行數:6,代碼來源:admin.ts

示例5: duplicateQuery

 duplicateQuery() {
   const clone = angular.copy(this.target);
   this.panelCtrl.addQuery(clone);
 }
開發者ID:ArcticSnowman,項目名稱:grafana,代碼行數:4,代碼來源:query_editor_row.ts

示例6: function

 get: function(){
     return publicConfig = publicConfig || ng1.copy(config);
 },
開發者ID:Timeyit,項目名稱:main,代碼行數:3,代碼來源:ngTableFilterConfig.ts

示例7: function

        function () {
          let $scope = $rootScope.$new()
          $scope.data = angular.copy(mockData)

          let ganttApi
          let ready = false
          $scope.api = function (api) {
            ganttApi = api

            ganttApi.core.on.ready($scope, function () {
              ready = true
            })
          }

          let ganttElement = $compile('<div gantt api="api" data="data">' +
            '<gantt-tree></gantt-tree>' +
            '</div>')($scope)

          $scope.$digest()
          $timeout.flush()

          expect(ganttApi).to.be.not.undefined
          expect(ready).to.be.ok

          expect(ganttApi.tree.isCollapsed(undefined)).to.be.undefined

          // All rows should be expanded on init
          angular.forEach(ganttApi.gantt.rowsManager.rows, function (row) {
            expect(ganttApi.tree.isCollapsed(row)).to.be.not.ok
          })

          // Collapse all rows
          ganttApi.tree.collapseAll()
          $scope.$digest()

          // Development row should be collapsed
          expect(ganttApi.tree.isCollapsed('development')).to.be.ok

          // All rows should be collapsed
          angular.forEach(ganttApi.gantt.rowsManager.rows, function (row) {
            expect(ganttApi.tree.isCollapsed(row)).to.be.ok
          })

          // Expand all rows
          ganttApi.tree.expandAll()
          $scope.$digest()

          // All rows should be expanded
          angular.forEach(ganttApi.gantt.rowsManager.rows, function (row) {
            expect(ganttApi.tree.isCollapsed(row)).to.be.not.ok
          })

          // GanttTreeNodeController
          let treeNodeElement = jQuery(ganttElement).find('[ng-controller="GanttTreeNodeController"]').first()
          let ganttTreeNodeController = angular.element(treeNodeElement[0]).scope()

          // First row name should be "Milestones"
          expect(ganttTreeNodeController.getValue()).to.be.eq('Milestones')

          // Collapsing should be disabled - no child rows
          expect(ganttTreeNodeController.isCollapseDisabled()).to.be.ok

          // Should get row content correctly. If undefined and if defined
          expect(ganttTreeNodeController.getRowContent()).to.be.eq('{{row.model.name}}')

          // Test row
          let testRow = ganttApi.gantt.rowsManager.rows[0]

          // Test undefined collapsed
          testRow._collapsed = undefined
          expect(ganttApi.tree.isCollapsed(testRow)).to.be.not.ok

          // Set custom content
          testRow.model.content = '> {{row.model.name}}'
          expect(ganttTreeNodeController.getRowContent()).to.be.eq('> {{row.model.name}}')

          // GanttTreeController
          let treeElement = jQuery(ganttElement).find('[ng-controller="GanttTreeController"]')
          let ganttTreeController = angular.element(treeElement).scope()

          // Get default header
          expect(ganttTreeController.getHeader()).to.be.eq('Name')

          // Get default header content
          expect(ganttTreeController.getHeaderContent()).to.be.eq('{{getHeader()}}')
        }
開發者ID:angular-gantt,項目名稱:angular-gantt,代碼行數:86,代碼來源:plugins.spec.ts

示例8: beforeEach

		beforeEach((): Security => (security = angular.copy(securityIndexController.securities[1])));
開發者ID:scottohara,項目名稱:loot,代碼行數:1,代碼來源:index.ts

示例9: saveCurrentPairAssignments

 async saveCurrentPairAssignments(pairAssignments: common.PairAssignmentSet, tribeId: String) {
     const response = await axios.post(`/api/${tribeId}/history`, angular.copy(pairAssignments));
     return response.data;
 }
開發者ID:robertfmurdock,項目名稱:Coupling,代碼行數:4,代碼來源:services.ts


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