How to use the angular.isDefined 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 Teradata / kylo / ui / ui-app / src / main / resources / static / js / feed-mgr / shared / properties-admin / properties-admin.ts View on Github external
angular.forEach(this.$scope.fieldList, (field: any) => {
            let dn: any = (field.displayName.length === 0);
            // Validate field
            let _: any = (field.$error.duplicate = angular.isDefined(keys[field.systemName]));
            hasError |= _;
            hasError |= (field.$error.missingName = dn);

            // Add to user fields object
            if (field.systemName.length > 0) {
                field.order = order++;
                keys[field.systemName] = true;
                model.push(angular.copy(field));
            }
        });
github mtr / angular-iscroll / src / lib / angular-iscroll.js View on Github external
function _destroyInstance() {
            if (refreshInterval !== null) {
                $interval.cancel(refreshInterval);
            }

            if (angular.isDefined(scope.iscrollInstance)) {
                delete scope.iscrollInstance;
            }
            instance.destroy();

            element.removeClass(classes.on).addClass(classes.off);
            // Remove element's CSS transition values:
            element.children('.iscroll-scroller').attr('style', null);

            angular.forEach(deregistrators, _call);
            //$log.debug('angular-iscroll: destroyInstance');
        }
github Teradata / kylo / ui / ui-app / src / main / resources / static / js / ops-mgr / alerts / alerts-table.ts View on Github external
ngOnInit(){
        this.pageName = angular.isDefined(this.pageName) ? this.pageName : 'alerts';
        //Page State
        this.loading = true;
        this.showProgress = true;
        //Pagination and view Type (list or table)
        this.paginationData = this.PaginationDataService.paginationData(this.pageName);
        this.PaginationDataService.setRowsPerPageOptions(this.pageName, ['5', '10', '20', '50', '100']);
        this.viewType = this.PaginationDataService.viewType(this.pageName);
        //Setup the Tabs
        this.tabNames = ['All', 'INFO', 'WARNING', 'MINOR', 'MAJOR', 'CRITICAL', 'FATAL'];
        this.tabs = this.TabService.registerTabs(this.pageName, this.tabNames, this.paginationData.activeTab);
        this.tabMetadata = this.TabService.metadata(this.pageName);
        this.sortOptions = this.loadSortOptions();
        this.PAGE_DIRECTION = {forward: 'f', backward: 'b', none: 'n'};
        this.additionalMenuOptions = this.loadAdditionalMenuOptions();
        this.selectedAdditionalMenuOptionVar = this.selectedAdditionalMenuOption;
github ngOfficeUIFabric / ng-officeuifabric / src / components / datepicker / datepickerDirective.ts View on Github external
private postLink($scope: IDatepickerDirectiveScope, $element: JQuery, attrs: any, ctrls: any[]): void {
    let datepickerController: DatepickerController = ctrls[0];
    let ngModel: angular.INgModelController = ctrls[1];

    datepickerController.initDatepicker(ngModel);
    if (angular.isDefined(ngModel) && ngModel !== null) {
      ngModel.$render = function (): void {
        if (
          ngModel.$modelValue !== null
          && ngModel.$modelValue !== ''
          && typeof ngModel.$modelValue !== 'undefined'
        ) {
          if (typeof ngModel.$modelValue === 'string') {
            let date: Date = new Date(ngModel.$modelValue);
            datepickerController.setValue(date);
          } else {
            datepickerController.setValue(ngModel.$modelValue);
          }
          ngModel.$setPristine();
        }
      };
    }
github JetBrains / ring-ui / components / table-legacy-ng / table-legacy-ng.js View on Github external
link: function link(scope, iElement, iAttrs) {
      const element = iElement[0];
      const FULL_WIDTH = 100;

      scope.isLimited = angular.isDefined(iAttrs.limited);
      scope.isUnlimited = angular.isDefined(iAttrs.unlimited);
      scope.isAvatar = angular.isDefined(iAttrs.avatar);
      scope.isWide = angular.isDefined(iAttrs.wide);
      scope.isAlignRight = angular.isDefined(iAttrs.alignRight);
      scope.isGray = angular.isDefined(iAttrs.gray);
      scope.isPullRight = angular.isDefined(iAttrs.pullRight);
      scope.isPullLeft = angular.isDefined(iAttrs.pullLeft);

      function adjustUnlimitedColumnWidths() {
        const unlimitedColumnsCount = element.parentNode.
          querySelectorAll('.ring-table__column[unlimited]').length;
        if (unlimitedColumnsCount > 1) {
          element.style.width = `${(FULL_WIDTH / unlimitedColumnsCount).toFixed()}%`;
        }
      }

      if (scope.isUnlimited) {
        adjustUnlimitedColumnWidths();
      }
    }
  };
github kpi-wdc / dj / assets / widgets / v2.steps / select-dataset.js View on Github external
.success(function (data) {
      		thos.datasets = data.reverse();
      		var selectedDS;
      		if(angular.isDefined(thos.datasetID)){
      			selectedDS = thos.datasets.filter(function(item){
        			return item.id == thos.datasetID;
      			});	
      		}
      	if (selectedDS && selectedDS.length > 0){
            thos.select(selectedDS[0])
        }
        thos.uploaded = false;  
    	})
    	.error(function (data, status) {
github json-schema-form / angular-schema-form / src / services / schema-form-decorators.provider.js View on Github external
angular.forEach(fields, function(field, type) {
      field.builder = field.builder || [];
      field.replace = angular.isDefined(field.replace) ? field.replace : true;
      decorators[name][type] = field;
    });
github ovh / manager / packages / manager / modules / cloud-universe-components / src / monitoring / directive.js View on Github external
Number.isNaN(+model.xmin) ? d3.min(this.data, timestampOf) : +model.xmin,
      Number.isNaN(+model.xmax) ? d3.max(this.data, timestampOf) : +model.xmax,
    ]);
    this.y.domain([ymin, ymax]);
    this.yAxis.tickFormat((p) => p + (model.unit ? ` ${model.unit}` : ''));
    if (model.timeScale) {
      if (model.timeScale.unit && model.timeScale.amount) {
        this.xAxis.ticks(d3.time[model.timeScale.unit], model.timeScale.amount);
      }
      if (model.timeScale.format) {
        this.xAxis.tickFormat(d3.time.format(model.timeScale.format));
      }
    } else {
      this.xAxis.ticks('days');
    }
    this.yAxis.ticks(angular.isDefined(model.yTicks) ? model.yTicks : 4);
    this.margin = model.margin || this.margin;
    this.resize();
    this.update();
  };
github mike-goodwin / owasp-threat-dragon / td / public / app / diagrams / elementpropdirectives.js View on Github external
reset();
        };

        scope.editThreat = function () {
            scope.save();
            reset();
        };

        scope.cancelEdit = function () {
            scope.threats[editIndex] = originalThreat;
            reset();
        };

        var threatId = $routeParams.threat;

        if (angular.isDefined(threatId)) {
            var matchingIndex = -1;

            scope.threats.forEach(function (threat, index) {
                if (threat.id == threatId) {
                    matchingIndex = index;
                }
            });

            if (matchingIndex >= 0) {
                scope.onEditThreat(matchingIndex);
            }
            else {
                logError('Invalid threat ID');
                $location.search('threat', null);
            }
        }
github ngOfficeUIFabric / ng-officeuifabric / src / components / callout / calloutDirective.ts View on Github external
attrs.$observe('uifArrow', (attrArrowDirection: string) => {

      if (angular.isDefined(attrArrowDirection) && angular.isUndefined(CalloutArrow[attrArrowDirection])) {
        calloutController.$log.error('Error [ngOfficeUiFabric] officeuifabric.components.callout - "' +
          attrArrowDirection + '" is not a valid value for uifArrow. It should be left, right, top, bottom.');
        return;
      }

      scope.arrowDirection = attrArrowDirection;

    });