angularjsangularangular-upgradeangular-hybrid

Angular Hybrid Application, Upgraded Component with Template Function not receiving $element or $attrs


As the title says, I am working in an Angular Hybrid app. I have an old AngularJS component that uses a template function to dynamically build itself based on the inputs passed in to it.

I've upgraded that component to be useable from Angular, however the template function for it no longer works because $element and $attrs aren't injected correctly in to the template function.

Here's a simple stackblitz showing the issue

As you can see, when using the component directly from AngularJS, it is given the $element and $attrs values correctly, but when rendering it as an upgraded component from Angular, it doesn't. Is there some way I'm supposed to provide those manually for the upgraded component?


Solution

  • Turns out this is currently a limitation of upgraded component template functions. I opened a bug on Angular's github here and received that response. I've opened a PR here to somewhat address the issue as best as possible.