How to use the @uirouter/core.filter function in @uirouter/core

To help you get started, we’ve selected a few @uirouter/core 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 ui-router / react-hybrid / src / angularjs / ReactUIViewAdapterComponent.tsx View on Github external
link: function(scope: IPortalScope, elem, attrs) {
      const debug = (method: string, message: string, ...args) =>
        debugLog('angularjs', 'react-ui-view-adapter', `${$id}/${attrs.name}`, method, message, ...args);

      const el = elem[0];
      let _ref = null;
      let destroyed = false;
      const $id = id++;
      const ignoredAttrKeys = ['$$element', '$attr'];
      attrs = filter(attrs, (val, key) => ignoredAttrKeys.indexOf(key) === -1) as any;

      debug('.link()', 'linking react-ui-view-adapter into ', el, attrs);

      // The UIView ref callback, which is called after the initial render
      const ref = (ref: HTMLElement) => {
        // If refs are the same - don't re-render React component.
        const isSameRef = ref && _ref === ref;

        // If previously there was a ref, and the new `ref` is empty - the component was unmounted.
        // Leave the unmounted component as it was, and don't try to re-mount it.
        const isComponentUnmounted = !ref && _ref;

        if (isSameRef || isComponentUnmounted) {
          return;
        }