IntelliJ is showing Ionic (for Angular) lifecycle hooks as unused methods

I am not sure if this is an issue of Ionic or IntelliJ, I just wanted to point that out and ask how other users go about it.

Comment actions Permalink

Can't reproduce with Angular lifecycle methods:



Please provide a screenshot with a code sample and inspection result.

Comment actions Permalink

@Elena: I mean Ionic lifecycle hooks. Ionic keeps initialized angular components in a stack-array and calls them pages. They do not get automatically destroyed when you leave a page, so theoretically all the pages in the app could exist in the DOM at a time. This is why additional hooks are needed for knowing when a page was put on top of the stack and became visible.

You can reproduce this by

npm install -g ionic
ionic start
# now select an angular project with pre-configured navigation
# add ionViewWillEnter() { console.log("entered"); } to one of the page-components.
# now as you switch between pages you will see that the method gets triggered
# but it is not shown as used
Comment actions Permalink

I see, thanks for clearing it up. Please vote for to be notified on any progress with it


Please sign in to leave a comment.