當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript angular.isDefined函數代碼示例

本文整理匯總了TypeScript中angular.isDefined函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript isDefined函數的具體用法?TypeScript isDefined怎麽用?TypeScript isDefined使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了isDefined函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

            link: function (scope: any, elem: any, attrs: any) {

                var scrollSelector = attrs.scrollSelector;

                var offset = angular.isDefined(attrs.offset) ? parseInt(attrs.offset) : 0;
                var scrollContainerElem = angular.isDefined(scrollSelector) ? angular.element(scrollSelector) : $win;
                var currLeftPos = elem[0].offsetLeft;

                scrollContainerElem.on('scroll', function (e) {
                    stickIt();
                });
                function stickIt() {
                    var scrollAmount = scrollContainerElem.scrollTop();
                    elem.css('top', (scrollAmount + offset) + 'px');
                    elem.css('position', 'absolute');
                    elem.css('padding-left', '15px')
                }

                elem.bind("stickIt", function () {
                    stickIt();
                });

                scope.$on('$destroy', function () {
                    elem.unbind("stickIt");
                });

            }
開發者ID:prashanthc97,項目名稱:kylo,代碼行數:27,代碼來源:sticky.ts

示例2: return

 return (str: string, regExStr: string, replaceValue: string) => {
   if (!isDefined(regExStr)) {
     $log.debug(`Did not supply regex string for 'replace' filter.`);
     return str;
   } else if (!isDefined(replaceValue)) {
     $log.debug(`Did not supply replacement value for 'replace' filter.`);
     return str;
   } else {
     return str.replace(new RegExp(regExStr, 'g'), replaceValue);
   }
 };
開發者ID:mizzy,項目名稱:deck,代碼行數:11,代碼來源:replace.filter.ts

示例3:

                                tableOptionInitializerPromise.then((file:any) => {

                                    var serviceName = $scope.tableOption.initializeServiceName;
                                    if(angular.isDefined(serviceName)) {
                                        var svc = $injector.get(serviceName);
                                        if (angular.isDefined(svc) && angular.isFunction(svc.initializeCreateFeed)) {
                                            var createFeedModel = FeedService.createFeedModel;
                                            svc.initializeCreateFeed($scope.tableOption, stepperController, createFeedModel);
                                        }
                                    }
                                });
開發者ID:prashanthc97,項目名稱:kylo,代碼行數:11,代碼來源:TableOptionsStepperDirective.ts

示例4: update

            link: ($scope: any, element: any, attrs: any)=> {

                $scope.truncatedFormat = angular.isDefined($scope.truncatedFormat) ? $scope.truncatedFormat : false;
                $scope.addAgoSuffix = angular.isDefined($scope.addAgoSuffix) ? $scope.addAgoSuffix : false;

                $scope.time = $scope.startTime;
                $scope.previousDisplayStr = '';
                $scope.$watch('startTime', (newVal: any, oldVal: any)=> {
                    $scope.time = $scope.startTime;
                    format();
                })
                format();
                var seconds = 0;
                var minutes = 0;
                var hours = 0;
                var days = 0;
                var months = 0;
                var years = 0;
                if ($scope.refreshTime == undefined) {
                    $scope.refreshTime = 1000;
                }
                function update() {
                    $scope.time += $scope.refreshTime;
                    //format it
                    format();
                }

                function format() {
                    var ms = $scope.time;
                    var displayStr = DateTimeUtils($filter('translate')).formatMillisAsText(ms,$scope.truncatedFormat,false);
                    if($scope.addAgoSuffix) {
                        displayStr += " ago";
                    }

                    if ($scope.previousDisplayStr == '' || $scope.previousDisplayStr != displayStr) {
                        element.html(displayStr);
                        element.attr('title', displayStr);
                    }
                    $scope.previousDisplayStr = displayStr;

                }

                var interval = $interval(update, $scope.refreshTime);

                var clearInterval = ()=> {
                    $interval.cancel(interval);
                    interval = null;
                }
                $scope.$on('$destroy', ()=> {
                    clearInterval()
                });
            }
開發者ID:prashanthc97,項目名稱:kylo,代碼行數:52,代碼來源:kylo-timer.ts

示例5: check

                /**
                 *
                 * @param permissions array of permissions needed (only 1 is needed)
                 * @param entity optional entity
                 */
                function check(permissions: any, entity: any, entityType: any) {

                    if (angular.isDefined(entity) && angular.isDefined(entityType)) {
                        validate(accessControlService.hasEntityAccess(permissions, entity,entityType));
                    }
                    else {
                        accessControlService.getUserAllowedActions(accessControlService.ACCESS_MODULES.SERVICES, true)
                            .then(function (actionSet: any) {
                                var valid = accessControlService.hasAnyAction(permissions, actionSet.actions);
                                validate(valid);
                            }, true);
                    }

                }
開發者ID:prashanthc97,項目名稱:kylo,代碼行數:19,代碼來源:ng-if-permission.ts

示例6: text

 this.text = function text(textId: string, projectId?: string): string {
   if (angular.isDefined(projectId)) {
     return this.project(projectId) + textId;
   } else {
     return this.project() + textId;
   }
 };
開發者ID:sillsdev,項目名稱:web-scriptureforge,代碼行數:7,代碼來源:link.service.ts

示例7: setupField

  /**
   * Sets up and configures properties for a dialog field
   * @memberof DialogDataService
   * @function setupField
   * @param data {any} This is a object that is all the information for a particular dialog field
   *
   **/
  public setupField(data: any) {
    let field = _.cloneDeep(data);
    const dropDownValues = [];
    field.fieldValidation = null;
    field.fieldBeingRefreshed = (angular.isDefined(field.fieldBeingRefreshed) ? field.fieldBeingRefreshed : false);
    field.errorMessage = '';

    if (field.type === 'DialogFieldDropDownList') {
      for (let option of field.values) {
        if (option[0] === String(field.default_value)) {
          field.selected = option;
        }
        if (field.data_type === 'integer') {
          dropDownValues.push([parseInt(option[0], 10), option[1]]);
        } else {
          dropDownValues.push(option);
        }
      }
      field.values = dropDownValues;
      field.values = this.updateFieldSortOrder(field);
    }
    field.default_value = this.setDefaultValue(field);

    return field;
  }
開發者ID:karelhala,項目名稱:ui-components,代碼行數:32,代碼來源:dialogData.ts

示例8: function

		vm.openColumnsSortPanel = function (value) {
			if (angular.isDefined(value))
				vm.columnSortPanelOpened = value;
			else {
				vm.columnSortPanelOpened = !vm.columnSortPanelOpened;
			}
		}
開發者ID:izenda,項目名稱:resources,代碼行數:7,代碼來源:instant-report-data-source-controller.ts

示例9: setDefaultValue

  /**
   *
   * This method sets default value for a dialog field
   * @memberof DialogDataService
   * @function setDefaultValue
   * @param data {any} This is a object that is all the information for a particular dialog field
   *
   **/
  private setDefaultValue(data): any {
    let defaultValue: any = '';
    const firstOption = 0; // these are meant to help make code more readable
    const fieldValue = 0;
    if (_.isObject(data.values)) {
      if (angular.isDefined(data.default_value) && data.default_value !== null) {
        defaultValue = data.default_value;
      } else {
        defaultValue = data.values[firstOption][fieldValue];
      }
    } else {
      if (data.type === 'DialogFieldDateControl' || data.type === 'DialogFieldDateTimeControl') {
        defaultValue = new Date(data.values);
      } else {
          defaultValue = data.values;
      }
    }
    if (data.default_value) {
      defaultValue = data.default_value;
    }

    if (data.data_type === 'integer') {
      defaultValue = parseInt(data.default_value, 10);
    }

    return defaultValue;
  }
開發者ID:karelhala,項目名稱:ui-components,代碼行數:35,代碼來源:dialogData.ts

示例10: project

 this.project = function project(projectId?: string, projectType: string = 'sfchecks'): string {
   if (angular.isDefined(projectId)) {
     return '/app/' + projectType + '/' + projectId + '#!/';
   } else {
     return '#!/';
   }
 };
開發者ID:sillsdev,項目名稱:web-scriptureforge,代碼行數:7,代碼來源:link.service.ts


注:本文中的angular.isDefined函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。