当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript angular.forEach函数代码示例

本文整理汇总了TypeScript中angular.forEach函数的典型用法代码示例。如果您正苦于以下问题:TypeScript forEach函数的具体用法?TypeScript forEach怎么用?TypeScript forEach使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了forEach函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

         this.uploadFileToUrl = function (files: any, uploadUrl: any, successFn: any, errorFn: any, params: any) {
            var fd = new FormData();
            var arr = files;
            if(!_.isArray(files)) {
                arr = [files];
            }
            if (arr.length > 1) {
                angular.forEach(arr, function(file: any, index: any) {
                    index += 1;
                    fd.append('file' + index, file);
                });
            } else {
                fd.append('file', arr[0]);
            }

            if (params) {
                angular.forEach(params, function (val: any, key: any) {
                    fd.append(key, val);
                })
            }
            $http.post(uploadUrl, fd, { 
                transformRequest: angular.identity,
                headers: {'Content-Type': undefined}
            })
                .then(function (data: any) {
                    if (successFn) {
                        successFn(data)
                    }
                },function (err: any) {
                    if (errorFn) {
                        errorFn(err)
                    }
                });
        }
开发者ID:prashanthc97,项目名称:kylo,代码行数:34,代码来源:FileUploadService.ts

示例2: function

                angular.forEach(rows, function (row:any, i:any) {

                    if (columns.length == 0) {
                        angular.forEach(row, function (val:any, name:any) {
                            var displayName = name;
                            if (name.indexOf('.') >= 0) {
                                displayName = name.substring(name.indexOf('.') + 1);
                            }
                            if (hideColumns && (_.contains(hideColumns, displayName) || _.contains(hideColumns, name))) {

                            }
                            else {
                                displayColumns.push(displayName)
                                columns.push(name);
                            }
                        });
                    }
                    if (transformFn != null) {

                        transformFn(row, columns, displayColumns);

                    }
                    angular.forEach(displayColumns, function (displayColumn:any, i:any) {
                        row[displayColumn] = row[columns[i]];
                    });
                });
开发者ID:prashanthc97,项目名称:kylo,代码行数:26,代码来源:HiveService.ts

示例3: initializeModule

export function initializeModule(target: Function, options: ModuleOptions) {
  const ngMod = createModule(target, options.dependencies, name(target, options));

  // Register values and constants
  ng.forEach(options.values, (val, key) => ngMod.value(key, val));
  ng.forEach(options.constants, (val, key) => ngMod.constant(key, val));
}
开发者ID:csvn,项目名称:ng-esm,代码行数:7,代码来源:module.ts

示例4: function

      var f = function (element) {
        if (element.data().hasOwnProperty('$scope')) {
          scopes++;
          angular.forEach(element.data().$scope.$$watchers, function () {
            count++;
          });
        }

        angular.forEach(element.children(), function (childElement) {
          f($(childElement));
        });
      };
开发者ID:AutogrowSystems,项目名称:grafana,代码行数:12,代码来源:grafana_app.ts

示例5: f

    const f = element => {
      if (element.data().hasOwnProperty('$scope')) {
        scopes++;
        angular.forEach(element.data().$scope.$$watchers, () => {
          count++;
        });
      }

      angular.forEach(element.children(), childElement => {
        f($(childElement));
      });
    };
开发者ID:ArcticSnowman,项目名称:grafana,代码行数:12,代码来源:profiler.ts

示例6: function

 this.cancelPendingHttpRequests = function () {
     angular.forEach($http.pendingRequests, function (request: any) {
         if (request.cancel && request.timeout) {
             request.cancel.resolve();
         }
     });
 }
开发者ID:prashanthc97,项目名称:kylo,代码行数:7,代码来源:HttpService.ts

示例7: moment

             var successFn =  (response: any)=> {

                 var unhealthyFeedNames: any[] = [];
                 if (response.data) {
                     angular.forEach(response.data,  (feedHealth: any)=> {
                         if (this.data.feedHealth[feedHealth.feed]) {
                             angular.extend(this.data.feedHealth[feedHealth.feed], feedHealth);
                         }
                         else {
                             this.data.feedHealth[feedHealth.feed] = feedHealth;
                         }
                         if (feedHealth.lastUnhealthyTime) {
                             feedHealth.sinceTimeString =  moment(feedHealth.lastUnhealthyTime).fromNow();
                         }
                         if (feedHealth.healthy) {
                        //     AlertsService.removeFeedFailureAlertByName(feedHealth.feed);
                         }
                         else {
                             unhealthyFeedNames.push(feedHealth.feed);
                      //       AlertsService.addFeedHealthFailureAlert(feedHealth);
                         }
                     });
                     //only unhealthy will come back
                     //if feedName is not in the response list, but currently failed.. remove it
               //      var failedFeeds = AlertsService.feedFailureAlerts;
            //         angular.forEach(failedFeeds, function (alert, feedName) {
            //             if (_.indexOf(unhealthyFeedNames, feedName) == -1) {
            //                 AlertsService.removeFeedFailureAlertByName(feedName);
             //            }
              //       });

                 }
                 this.data.fetchFeedHealthTimeout();
             }
开发者ID:prashanthc97,项目名称:kylo,代码行数:34,代码来源:OpsManagerFeedService.ts

示例8: function

        return function (items: any, filterOn: any) {

            if (filterOn === false) {
                return items;
            }

            if ((filterOn || angular.isUndefined(filterOn)) && angular.isArray(items)) {
                var hashCheck: any = {}, newItems: any[] = [];

                var extractValueToCompare = function (item: any) {
                    if (angular.isObject(item) && angular.isString(filterOn)) {
                        return item[filterOn];
                    } else {
                        return item;
                    }
                };

                angular.forEach(items, (item: any)=> {
                    var valueToCheck, isDuplicate = false;

                    for (var i = 0; i < newItems.length; i++) {
                        if (angular.equals(extractValueToCompare(newItems[i]), extractValueToCompare(item))) {
                            isDuplicate = true;
                            break;
                        }
                    }
                    if (!isDuplicate) {
                        newItems.push(item);
                    }

                });
                items = newItems;
            }
            return items;
        };
开发者ID:prashanthc97,项目名称:kylo,代码行数:35,代码来源:filters.ts


注:本文中的angular.forEach函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。