How to use the angular.forEach 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 swimlane / angular-model-factory / src / utils.js View on Github external
export let extendDeep = function(dst) {
  angular.forEach(arguments, function(obj) {
    if (obj !== dst) {
      angular.forEach(obj, function(value, key) {
        if (instanceKeywords.indexOf(key) === -1) {
          if (dst[key]) {
            if (angular.isArray(dst[key])) {
              dst[key].concat(value.filter(function(v) {
                var vv = dst[key].indexOf(v) !== -1;
                if (vv) extendDeep(vv, v);
                return vv;
              }));
            } else if (angular.isObject(dst[key])) {
              extendDeep(dst[key], value);
            } else {
              // if value is a simple type like a string, boolean or number
              // then assign it
              dst[key] = value;
github esvit / ng-table / src / browser / ngTableController.ts View on Github external
loadFilterData($columns: ColumnDef[]) {
        ng1.forEach($columns, ($column) => {
            const result = $column.filterData(this.$scope);
            if (!result) {
                delete $column.filterData;
                return undefined;
            }

            if (isPromiseLike(result)) {
                delete $column.filterData;
                return result.then(data => {
                    // our deferred can eventually return arrays, functions and objects
                    if (!ng1.isArray(data) && !ng1.isFunction(data) && !ng1.isObject(data)) {
                        // if none of the above was found - we just want an empty array
                        data = [];
                    }
                    $column.data = data;
                });
github Teradata / kylo / ui / ui-app / src / main / resources / static / js / feed-mgr / datasources / DatasourcesDetailsController.ts View on Github external
.then((datasources: any) => {
                    this.existingDatasourceNames = {};
                    angular.forEach(datasources, (datasource) => {
                        this.existingDatasourceNames[datasource.name.toLowerCase()] = true;
                    });
                })
                .then(this.validate);
github cockpit-project / cockpit / pkg / kubernetes / scripts / images.js View on Github external
function handle_image(image) {
                        var item;
                        var manifest = image.dockerImageManifest;
                        if (manifest) {
                            manifest = JSON.parse(manifest);
                            angular.forEach(manifest.history || [], function(item) {
                                if (typeof item.v1Compatibility == "string")
                                    item.v1Compatibility = JSON.parse(item.v1Compatibility);
                            });
                            item = {
                                kind: "DockerImageManifest",
                                metadata: {
                                    name: image.metadata.name,
                                    selfLink: "/internal/manifests/" + image.metadata.name
                                },
                                manifest: manifest,
                            };
                            loader.handle(item);
                        }
                    }
github openstack / openstack-health / app / js / services / projects.js View on Github external
angular.forEach(projects, function(project) {
      angular.forEach(project.runs, function(run) {
        var stats = findOrCreate(index, dateStats, run.date, createDateStats);
        stats.metrics = metricsService.addMetrics(stats.metrics, run.metrics);
      });
    });
github apache / incubator-streampipes / src / app / editor / filter / select.filter.ts View on Github external
return (pipelineElements, selectedOptions) => {
            var filteredElements = [];
            angular.forEach(pipelineElements, pe => {
                if (!pe.category || pe.category.length === 0) {
                    filteredElements.push(pe);
                }
                angular.forEach(selectedOptions, so => {
                    if (pe.category.indexOf(so) !== -1) {
                        filteredElements.push(pe);
                    }
                })
            })
            return filteredElements;
        }
    }
github apache / incubator-streampipes / src / app / pipelines / dialog / start-all-pipelines-dialog.controller.ts View on Github external
getPipelinesToModify() {
        angular.forEach(this.pipelines, pipeline => {
            if (pipeline.running != this.action && this.hasCategory(pipeline)) {
                this.pipelinesToModify.push(pipeline);
            }
        });
    }
github cockpit-project / cockpit / pkg / kubernetes / scripts / nodes.js View on Github external
function refreshData() {
                                var nodes = $scope.nodes;
                                var data = [];

                                if (!nodes)
                                    nodes = [];

                                angular.forEach(nodes, function(node) {
                                    var result, value, name;
                                    var tooltip = _("Unknown");
                                    if (node && node.metadata)
                                        name = node.metadata.name;

                                    if (!name)
                                        return;

                                    result = $scope.stats.getSimpleUsage(node, currentTab);
                                    if (result)
                                        value = result.used / result.total;

                                    if (value === undefined)
                                        value = -1;
                                    else
                                        tooltip = tabs[currentTab].tooltip(result);
github Teradata / kylo / ui / ui-app / src / main / resources / static / js / auth / users / user-details / UserDetailsController.ts View on Github external
.then((users:any) => {
                            this.userMap = {};
                            angular.forEach(users, (user:any) => {
                                this.userMap[user.systemName] = true;
                            });
                        });
            }
github marmelab / ng-admin / src / javascripts / ng-admin / Crud / component / service / CrudManager.js View on Github external
CrudManager.prototype.getReferencedValues = function(entityName) {
        var self = this,
            references = this.getReferences(entityName),
            calls = [];

        angular.forEach(references, function(reference) {
            calls.push(self.getAll(reference.targetEntity().name(), 1, false))
        });

        return this.$q.all(calls)
            .then(function(responses) {
                var i = 0;
                angular.forEach(references, function(reference, index) {
                    references[index].setChoices(self.getReferenceChoices(reference, responses[i++].entities));
                });

                return references;
            });
    };