How to use the angular.isFunction 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 spring-projects / spring-flo / tests / resources / metamodel-service.js View on Github external
return $http.get('/parse', { params: {'text': definitionText}}).success(function(data) {
				if (angular.isFunction(setErrorFn)) {
					setErrorFn(null);
				}
				if (typeof data === 'string') {
					data = angular.fromJson(data);
				}
				// TODO handle error case, clear the graph
				$log.info('parse responded with data:\''+JSON.stringify(data)+'\'');
				if (angular.isFunction(updateGraphFn)) {
					updateGraphFn(data);
				}
			}).error(function(data, status, headers, config, statusText) { // jshint ignore:line
				if (typeof data === 'string') {
github shaungrady / angular-http-etag / src / provider.js View on Github external
function httpEtagParseCacheKey (cacheId, url, params) {
      cacheId = getFullCacheId(cacheId);

      var keyParser = cacheService.get(cacheId).info().keyParser,
          key, queryString;

      if (angular.isFunction(keyParser))
        key = keyParser(url, params);

      // Failsafe
      if (angular.isUndefined(key)) {
        queryString = stringifyParams(params);
        key = url + ((url.indexOf('?') == -1) ? '?' : '&') + queryString;
      }

      return key;
    }
github grafana / grafana / public / app / core / services / ng_react.ts View on Github external
return Object.keys(obj || {}).reduce((prev, key) => {
    const value = obj[key];
    const config = (propsConfig || {})[key] || {};
    /**
     * wrap functions in a function that ensures they are scope.$applied
     * ensures that when function is called from a React component
     * the Angular digest cycle is run
     */
    // @ts-ignore
    prev[key] = angular.isFunction(value) && config.wrapApply !== false ? applied(value, scope) : value;

    return prev;
  }, {});
}
github spring-projects / spring-flo / src / controllers / palette.js View on Github external
function handleDrag(event) {
			// TODO offsetX/Y not on firefox
			//$log.debug("tracking move: x="+event.pageX+",y="+event.pageY);
			if (clickedElement && clickedElement.attr('metadata')) {
				if (!viewBeingDragged) {
					var dataOfClickedElement = clickedElement.attr('metadata');
					// custom div if not already built.
					$('<div>', {
						id: 'palette-floater'
					}).appendTo($('body'));
					var floatergraph = new joint.dia.Graph();
					floatergraph.attributes.type = joint.shapes.flo.FEEDBACK_TYPE;
					var floaterpaper = new joint.dia.Paper({
						el: $('#palette-floater'),
                        elementView: renderService &amp;&amp; angular.isFunction(renderService.getNodeView) ? renderService.getNodeView() : joint.dia.ElementView,
                        gridSize:10,
						model: floatergraph,
						height: 400,
						width: 200,
						validateMagnet: function() {
							return false;
						},
						validateConnection: function() {
							return false;
						}
					});
					// TODO float thing needs to be bigger otherwise icon label is missing
					// Initiative drag and drop - create draggable element
					var floaternode = shapesFactory.createNode({
						'renderService': renderService,
						'paper': floaterpaper,</div>
github GridProtectionAlliance / openHistorian / Source / Applications / openHistorian / openHistorian / Grafana / public / app / core / services / ng_react.ts View on Github external
function getReactComponent(name: string, $injector: auto.IInjectorService) {
  // if name is a function assume it is component and return it
  if (angular.isFunction(name)) {
    return name;
  }

  // a React component name must be specified
  if (!name) {
    throw new Error('ReactComponent name attribute must be specified');
  }

  // ensure the specified React component is accessible, and fail fast if it's not
  let reactComponent;
  try {
    reactComponent = $injector.get(name);
  } catch (e) {}

  if (!reactComponent) {
    try {
github Enalean / tuleap / src / themes / tlp / angular-tlp / tlp-modal-service.js View on Github external
var body = $document.find("body").eq(0);
        var modal_instance = {};

        var controller = prepareControllerInjection(
            scope,
            modal_instance,
            options,
            resolved_dependencies
        );

        var compiled_modal = $compile(template)(scope);
        var dom_modal_element = compiled_modal[0];
        body.append(dom_modal_element);
        modal_instance.tlp_modal = createModal(dom_modal_element, tlp_modal_options);

        if (isFunction(controller.$onInit)) {
            controller.$onInit();
        }

        modal_instance.tlp_modal.show();

        modal_instance.tlp_modal.addEventListener("tlp-modal-hidden", function () {
            compiled_modal.remove();
            scope.$destroy();
            delete modal_instance.tlp_modal;
        });

        return modal_instance.tlp_modal;
    }
github json-schema-form / angular-schema-form / src / services / sf-error-message.provider.js View on Github external
}
        if (val && val[error]) {
          message = val[error];
          return true;
        }
      });

      let context = {
        error: error,
        value: value,
        viewValue: viewValue,
        form: form,
        schema: form.schema,
        title: form.title || (form.schema && form.schema.title),
      };
      if (angular.isFunction(message)) {
        return message(context);
      }
      else {
        return $interpolate(message)(context);
      }
    };
github epam / NGB / client / client / app / components / ngbProjectInfoPanel / ngbProjectInfo / ngbVariantDensityDiagram / ngbVariantDensityDiagram.controller.js View on Github external
async updateDiagram(variants, isLoading, error) {
        if (isLoading) {
            return;
        }
        if (!variants || variants.length === 0) {
            this._scope.options.chart.noData = error || 'No Data Available';
            this._scope.data = [];
        } else {
            this._scope.data = this.makeNvD3ChartObjectFromData(variants);
        }
        this._scope.api && angular.isFunction(this._scope.api.update) ? this._scope.api.update() : '';
    }
}
github Teradata / kylo / ui / ui-app / src / main / resources / static / js / ops-mgr / services / OpsManagerJobService.ts View on Github external
}, (msg: any) =>{
                    if(errorCallback && angular.isFunction(errorCallback)) {
                        errorCallback(msg);
                    }
                })
            };
github gbif / portal16 / app / views / components / filterInterval / intervalSlider.directive.js View on Github external
vm.remove = function() {
            if (angular.isFunction(vm.intervalOptions.remove)) {
                vm.intervalOptions.remove(vm.intervalOptions);
            }
        };