• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript angular.isArray函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: function

        this.settings = function(newSettings?: ISettings<T>) {
            if (ng1.isDefined(newSettings)) {

                // todo: don't modify newSettings object: this introduces unexpected side effects;
                // instead take a copy of newSettings

                if (newSettings.filterOptions){
                    newSettings.filterOptions = ng1.extend({}, _settings.filterOptions, newSettings.filterOptions);
                }
                if (newSettings.groupOptions){
                    newSettings.groupOptions = ng1.extend({}, _settings.groupOptions, newSettings.groupOptions);
                }

                if (ng1.isArray(newSettings.dataset)) {
                    //auto-set the total from passed in dataset
                    newSettings.total = newSettings.dataset.length;
                }

                var originalDataset = _settings.dataset;
                _settings = ng1.extend(_settings, newSettings);

                if (ng1.isArray(newSettings.dataset)) {
                    optimizeFilterDelay();
                }

                // note: using != as want null and undefined to be treated the same
                var hasDatasetChanged = newSettings.hasOwnProperty('dataset') && (newSettings.dataset != originalDataset);
                if (hasDatasetChanged) {
                    if (isCommittedDataset){
                        this.page(1); // reset page as a new dataset has been supplied
                    }
                    isCommittedDataset = false;

                    var fireEvent = function () {
                        ngTableEventsChannel.publishDatasetChanged(self, newSettings.dataset, originalDataset);
                    };

                    if (initialEvents){
                        initialEvents.push(fireEvent);
                    } else {
                        fireEvent();
                    }
                }
                log('ngTable: set settings', _settings);
                return this;
            }
            return _settings;
        };
开发者ID:Timeyit,项目名称:main,代码行数:48,代码来源:ngTableParams.ts


示例2: function

    angular.forEach(rowLabelsElements, function (rowLabelElement, i) {
      rowLabelElement = jQuery(rowLabelElement)

      let rowModel = data[i]
      let rowText = rowLabelElement.text().trim()
      if (contentNotSupported || rowModel.content === undefined) {
        expect(rowText).to.be.eq(rowModel.name)
      } else {
        let rowHtmlModel = rowModel.content
        rowHtmlModel = rowHtmlModel.replace('{{row.model.name}}', rowModel.name)
        let expectedRowText = rowHtmlModel.replace(/<(?:.|\n)*?>/gm, '').trim() // Strip HTML
        expect(rowText).to.be.eq(expectedRowText)
      }

      if (rowModel.classes) {
        let rowClasses = rowModel.classes
        if (!angular.isArray(rowClasses)) {
          rowClasses = [rowClasses]
        }

        angular.forEach(rowClasses, function (rowClass) {
          expect(rowLabelElement.parents().hasClass(rowClass)).to.be.ok
        })
      }
    })
开发者ID:angular-gantt,项目名称:angular-gantt,代码行数:25,代码来源:plugins.spec.ts


示例3: localeTextWithParams

	/**
	 * Apply locale string in format "...{0}...{1}..." and apply instead of '{n}' params[n]
	 * @param {string} locale text key. This key contains in resources.
	 * @param {strong} defaultValue. Default value if locale resource wasn't found.
	 * @param {Array} params. Additional params.
	 * @returns {string}. Localized text. 
	 */
	localeTextWithParams(key: string, defaultValue: string, params: string[]): string {
		let result = this.localeText(key, defaultValue);
		if (angular.isArray(params))
			params.forEach((param, iParam) =>
				result = result.replaceAll(`{${iParam}}`, param));
		return result;
	}
开发者ID:izenda,项目名称:resources,代码行数:14,代码来源:localization-service.ts


示例4: it

    it('should be wrapped in an array if array: true', function() {
      const m = $umf.compile('/foo?param1', { params: { param1: { array: true } } });

      // empty array [] is treated like "undefined"
      expect(m.format({ param1: undefined })).toBe('/foo');
      expect(m.format({ param1: [] })).toBe('/foo');
      expect(m.format({ param1: '' })).toBe('/foo');
      expect(m.format({ param1: '1' })).toBe('/foo?param1=1');
      expect(m.format({ param1: ['1'] })).toBe('/foo?param1=1');
      expect(m.format({ param1: ['1', '2'] })).toBe('/foo?param1=1&param1=2');

      expect(m.exec('/foo')).toEqual({ param1: undefined });
      expect(m.exec('/foo', {})).toEqual({ param1: undefined });
      expect(m.exec('/foo', { param1: '' })).toEqual({ param1: undefined });
      expect(m.exec('/foo', { param1: '1' })).toEqual({ param1: ['1'] });
      expect(m.exec('/foo', { param1: ['1', '2'] })).toEqual({ param1: ['1', '2'] });

      $url.url('/foo');
      expect(m.exec($url.path(), $url.search())).toEqual({ param1: undefined });
      $url.url('/foo?param1=');
      expect(m.exec($url.path(), $url.search())).toEqual({ param1: undefined });
      $url.url('/foo?param1=bar');
      expect(m.exec($url.path(), $url.search())).toEqual({ param1: ['bar'] });
      $url.url('/foo?param1=bar&param1=baz');
      if (angular.isArray($url.search()))
        // conditional for angular 1.0.8
        expect(m.exec($url.path(), $url.search())).toEqual({ param1: ['bar', 'baz'] });

      expect(m.format({})).toBe('/foo');
      expect(m.format({ param1: undefined })).toBe('/foo');
      expect(m.format({ param1: '' })).toBe('/foo');
      expect(m.format({ param1: 'bar' })).toBe('/foo?param1=bar');
      expect(m.format({ param1: ['bar'] })).toBe('/foo?param1=bar');
      expect(m.format({ param1: ['bar', 'baz'] })).toBe('/foo?param1=bar&param1=baz');
    });
开发者ID:angular-ui,项目名称:ui-router,代码行数:35,代码来源:urlMatcherFactorySpec.ts


示例5: 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


示例6: customizer

export function assignPartialDeep<T extends TPartial, TPartial>(
    destination: T, 
    partial: TPartial,
    optionalPropSelector: (key: string, destination: T) => boolean = () => false,
    customizer: (destValue: any, srcValue: any, key: string) => any = () => undefined
 ) {
    const keys = Object.keys(partial);
    for(const key of keys) {
        let srcVal = partial[key];
        if (srcVal === undefined) {
            if (optionalPropSelector(key, destination)){
                destination[key] = srcVal;
            } else {
                // don't assign undefined to destination
            }
            continue;
        }

        const destVal = destination[key];
        const customVal = customizer(destVal, srcVal, key);
        if (customVal !== undefined){
            destination[key] = customVal;
        } else if (ng1.isArray(srcVal)) {
            destination[key] = [...srcVal];
        } else if (!ng1.isObject(srcVal)) {
            destination[key] = srcVal;
        } else {
            destination[key] = assignPartialDeep(destVal, srcVal);
        }
    }
    return destination;
}
开发者ID:QuBaR,项目名称:ng-table,代码行数:32,代码来源:assign-partial-deep.ts


示例7:

 const removePrototype = (srcVal: any, objVal: any) => {
     if (ng1.isObject(objVal) && !ng1.isArray(objVal)) {
         return _.toPlainObject(objVal);
     } else {
         return objVal;
     }
 };
开发者ID:QuBaR,项目名称:ng-table,代码行数:7,代码来源:jasmine-extensions.ts


示例8: if

			constraintFilters.forEach(constraintFilter => {
				const constraintFilterOperatorValue = constraintFilter && constraintFilter.operator ? constraintFilter.operator.value : '';

				if (constraintFilter.field !== null && angular.isObject(constraintFilter.operator)
					&& constraintFilterOperatorValue !== '' && angular.isArray(constraintFilter.values)
					&& constraintFilter.values.length > 0) {
					const constraintParamPart = {};
					constraintParamPart[`fc${counter}`] = constraintFilter.field.sysname;
					constraintParamPart[`fo${counter}`] = constraintFilterOperatorValue;
					const constraintOperatorType = this.getFieldFilterOperatorValueType(constraintFilter.operator);
					if (constraintOperatorType === 'twoValues') {
						constraintParamPart[`fvl${counter}`] = constraintFilter.values[0];
						constraintParamPart[`fvr${counter}`] = constraintFilter.values[1];
					} else if (constraintOperatorType === 'twoDates') {
						constraintParamPart[`fvl${counter}`] = moment(constraintFilter.values[0]).format(this.$izendaSettingsService.getDateFormat().shortDate);
						constraintParamPart[`fvr${counter}`] = moment(constraintFilter.values[1]).format(this.$izendaSettingsService.getDateFormat().shortDate);
					} else if (constraintOperatorType === 'oneDate') {
						constraintParamPart[`fvl${counter}`] = moment(constraintFilter.values[0]).format(this.$izendaSettingsService.getDateFormat().shortDate);
					} else if (constraintOperatorType === 'field') {
						const val = angular.isObject(constraintFilter.values[0])
							? constraintFilter.values[0].sysname
							: '';
						constraintParamPart[`fvl${counter}`] = val;
					} else {
						constraintParamPart[`fvl${counter}`] = constraintFilter.values.join(',');
					}

					angular.extend(queryParams, constraintParamPart);
					counter++;
				}
			});
开发者ID:izenda,项目名称:resources,代码行数:31,代码来源:instant-report-query.ts


示例9: function

angular.module("eperusteApp").directive("oikeustarkastelu", function(PerusteprojektiOikeudetService) {
    return {
        restrict: "A",
        link(scope, element: any, attrs: any) {
            var oikeudet = scope.$eval(attrs.oikeustarkastelu);
            if (!angular.isArray(oikeudet)) {
                oikeudet = [oikeudet];
            }
            if (
                !_.any(oikeudet, function(o: any) {
                    return PerusteprojektiOikeudetService.onkoOikeudet(o.target, o.permission);
                })
            ) {
                // Ei toimi jos ng-disabled myös käytössä
                /*
                if (element.prop("tagName") === "BUTTON") {
                    element.prop("disabled", true);
                } else {
                    element.hide();
                }
                */
                element.hide();
            }
        }
    };
});
开发者ID:Opetushallitus,项目名称:eperusteet,代码行数:26,代码来源:oikeustarkastelu.ts


示例10: function

        this.appendTransform = function (defaults: any, transform: any) {

            // We can't guarantee that the default transformation is an array
            defaults = angular.isArray(defaults) ? defaults : [defaults];

            // Append the new transformation to the defaults
            return defaults.concat(transform);
        }
开发者ID:prashanthc97,项目名称:kylo,代码行数:8,代码来源:HttpService.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript angular.isDefined函数代码示例发布时间:2022-05-28
下一篇:
TypeScript angular.fromJson函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap