Angular2's ViewChildren decorator with QueryList - unknown type for IDE

Hi

In Angular 2 (in WebStorm obviously) I am trying to use the `@ViewChildren` decorator to count the child instances of certain type.

@ViewChildren(StepComponent) steps: QueryList<StepComponent>;

Somehow the QueryList type behaves weird in the editor. It is marked red as unrecognized, when I hover it - a blueish baloon suggests query_list.d.ts with option-enter keystroke - but when I type it nothing really happens. How should I resolve this thing?

3 comments
Comment actions Permalink

Not sure what's going on... just adding

import {QueryList}  from '@angular/core';

should do the thing

0
Comment actions Permalink

Restarting WS did the trick. The memory must have been clogged or whatnot.

By the way: while I appreciate the assistance WS offers for auto-imports in the middle of the class,why don't we have even more help when putting imports by hand, so that typing `import QueryList` does auto-complete the statement... Currently I have to first write the "from" part in order to trigger WS help. 

0
Comment actions Permalink

we have a similar feature request, please vote: https://youtrack.jetbrains.com/issue/WEB-20944

0

Please sign in to leave a comment.