當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。