Autocomplete for Angular directives registered w/a variable rather than a string

We are registering Angular directives/components using a variable rather than a hardcoded string.

hardcoded string:

AppModule.component('myCustomComponent', {
template: '<div>text</div>',
controller: function() { }


variable (desired):

var name = 'myCustomComponent2';

AppModule.component(name, {
template: '<div>text</div>',
controller: function() { }


However, autocomplete in HTML only seems to work for the hardcoded string:

<my-custom-component></my-custom-component> <!-- autocomplete works! -->

But not for the variable:

<my-custom-component-2></my-custom-component-2> <!-- autocomplete does not work! -->


Is it possible to get WebStorm to read the string out of the variable?

For context, our use case is that we are storing the directive/component name alongside the directive/component definition object. We then register with the exported name in a manifest file.

import { name1 }, comp1 from './ComponentDefinition.js';
import { name2 }, comp2 from './ComponentDefinition2.js';

AppModule.component(name, comp1);
AppModule.component(name2, comp2);

Thanks for reading!


1 comment
Comment actions Permalink

Submitted, Please vote for it to be notified on any progress


Please sign in to leave a comment.