How to use the angular.copy function in angular

To help you get started, we’ve selected a few angular examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gbif / portal16 / app / views / shared / layout / html / angular / datasetFilter.service.js View on Github external
function refreshData(query) {
            var apiQuery;
            state.query = query || $stateParams;
            apiQuery = angular.copy(state.query);
            apiQuery.facet = exhaustiveFacets;

            if (state.data.$cancelRequest) state.data.$cancelRequest();
            state.data = DatasetSearch.query(apiQuery, function() {
                state.failedRequest = false;
                // state.data.facets = facetArrayToMap(state.data.facets, state.data.count);
            }, function() {
                state.failedRequest = true;
            });

            // get multiselect facets only for keys that is filtered since we have already asked without multiselect and hence would get the same result twice
            apiQuery.facetMultiselect = true;
            apiQuery.limit = 0; // no need to get the same results again
            apiQuery.facet = [];
            multiSelectFacetsKeys.forEach(function(key) {
                if (angular.isDefined(apiQuery[key]) && [].concat(apiQuery[key]).length > 0) {
github ovh / manager / packages / manager / modules / sms / src / sms / options / response / telecom-sms-options-response.controller.js View on Github external
.then((responses) => {
        this.enums = responses.enums;

        // Reordered available responses
        // ["cgi", "none", "text"] => ["none", "cgi", "text"]
        this.enums.smsResponseType.splice(
          0,
          0,
          this.enums.smsResponseType.splice(1, 1)[0],
        );
        this.service = angular.copy(responses.service);
        this.smsResponse = angular.copy(result(this.service, 'smsResponse'));
        this.senders = responses.senders;
        this.computeRemainingChar();
      })
      .catch((err) => {
github ngageoint / mage-server / public / mage-app / src / ng1 / observation / form / geometry.edit.form.component.js View on Github external
onLatLngChange() {
    var coordinates = angular.copy(this.feature.geometry.coordinates);

    // copy edit field lat/lng in coordinates at correct index
    if (this.feature.geometry.type === 'Point') {
      coordinates = angular.copy([Number(this.longitudeField.value), Number(this.latitudeField.value)]);
    } else if (this.feature.geometry.type === 'LineString') {
      coordinates[this.selectedVertexIndex] = angular.copy([Number(this.longitudeField.value), Number(this.latitudeField.value)]);
    } else if (this.feature.geometry.type === 'Polygon') {
      if (coordinates[0]) {
        coordinates[0][this.selectedVertexIndex] = angular.copy([Number(this.longitudeField.value), Number(this.latitudeField.value)]);
      }
    }

    // transform corrdinates to valid GeoJSON
    this.toGeoJSON(this.feature, coordinates);

    // Check for polygon for intersections
    if (this.hasIntersections(this.feature, coordinates)) {
      return;
    }
github kpi-wdc / dj / assets / widgets / v2.nvd3-scatter / wizard.js View on Github external
.onStart(function(wizard){
	          	wizard.conf = {};
	            angular.copy(wizard.parentScope.widget, wizard.conf);
	            console.log("Start conf", wizard.conf)
	          })
github kpi-wdc / dj / assets / widgets / v2.nvd3-line / wizard.js View on Github external
.onStart(function(wizard){
	          	wizard.conf = {};
	            angular.copy(wizard.parentScope.widget, wizard.conf);
	            console.log("Start conf", wizard.conf)
	          })
github GridProtectionAlliance / openHistorian / Source / Applications / openHistorian / openHistorian / Grafana / public / app / plugins / datasource / opentsdb / datasource.ts View on Github external
if (!target.disableDownsampling) {
      let interval = this.templateSrv.replace(target.downsampleInterval || options.interval);

      if (interval.match(/\.[0-9]+s/)) {
        interval = parseFloat(interval) * 1000 + 'ms';
      }

      query.downsample = interval + '-' + target.downsampleAggregator;

      if (target.downsampleFillPolicy && target.downsampleFillPolicy !== 'none') {
        query.downsample += '-' + target.downsampleFillPolicy;
      }
    }

    if (target.filters && target.filters.length > 0) {
      query.filters = angular.copy(target.filters);
      if (query.filters) {
        for (const filterKey in query.filters) {
          query.filters[filterKey].filter = this.templateSrv.replace(
            query.filters[filterKey].filter,
            options.scopedVars,
            'pipe'
          );
        }
      }
    } else {
      query.tags = angular.copy(target.tags);
      if (query.tags) {
        for (const tagKey in query.tags) {
          query.tags[tagKey] = this.templateSrv.replace(query.tags[tagKey], options.scopedVars, 'pipe');
        }
      }
github GridProtectionAlliance / openHistorian / Source / Applications / openHistorian / openHistorian / Grafana / public / app / plugins / datasource / opentsdb / datasource.ts View on Github external
}
    }

    if (target.filters && target.filters.length > 0) {
      query.filters = angular.copy(target.filters);
      if (query.filters) {
        for (const filterKey in query.filters) {
          query.filters[filterKey].filter = this.templateSrv.replace(
            query.filters[filterKey].filter,
            options.scopedVars,
            'pipe'
          );
        }
      }
    } else {
      query.tags = angular.copy(target.tags);
      if (query.tags) {
        for (const tagKey in query.tags) {
          query.tags[tagKey] = this.templateSrv.replace(query.tags[tagKey], options.scopedVars, 'pipe');
        }
      }
    }

    if (target.explicitTags) {
      query.explicitTags = true;
    }

    return query;
  }
github grafana / grafana / public / app / plugins / datasource / opentsdb / datasource.ts View on Github external
}
    }

    if (target.filters && target.filters.length > 0) {
      query.filters = angular.copy(target.filters);
      if (query.filters) {
        for (const filterKey in query.filters) {
          query.filters[filterKey].filter = this.templateSrv.replace(
            query.filters[filterKey].filter,
            options.scopedVars,
            'pipe'
          );
        }
      }
    } else {
      query.tags = angular.copy(target.tags);
      if (query.tags) {
        for (const tagKey in query.tags) {
          query.tags[tagKey] = this.templateSrv.replace(query.tags[tagKey], options.scopedVars, 'pipe');
        }
      }
    }

    if (target.explicitTags) {
      query.explicitTags = true;
    }

    return query;
  }
github json-schema-form / angular-schema-form / src / directives / array.js View on Github external
scope.copyWithIndex = function(index) {
          if (!formDefCache[index]) {
            if (subForm) {
              var copy = angular.copy(subForm);
              copy.arrayIndex = index;
              schemaForm.traverseForm(copy, setIndex(index));
              formDefCache[index] = copy;
            }
          }
          return formDefCache[index];
        };