There’s absolutely nothing wrong with this line of code. search is necessary and it should work when I search. The problem is because of this error message, the whole app doesn’t start on ionic lab.
Is there any way to bypass this error message? because this is not an error.
and I was following this guideline here which tells me to include this line of command in ionViewDidload:
But Typescript sees that ‘search’ as an unnecessary command.
When I have two search engines built within a single app, it will not start ionic lab due to having two errors.
I have no idea what the problem is…or is there any other way to work around it?
Ionic lab works when I remove that command and restart and then add it again.
Sorry, nothing worked.
It’s so strange because in previous version of angular, it worked well. I think that’s why the tutorial from 2017 doesn’t have any fix for this.
The app works when I remove the codes inside ionViewDidLoad and start then add the codes back again.
The app would be still running without saying ‘search was declared but never used’. This only happens when I start the app with the code.
search => {this.setFilteredItems()
should be used in ionViewDidLoad to make search bar work…
I just clicked through to the tutlorial and the code looks broken. Perhaps a line went missing after an update. searchTerm is basically declared but never used. You need to set searchTerm to the value search, in order for everything to work.
I changed this configuration in tsconfig.json from true to false:
"noUnusedParameters": false,
and now typescript stopped throwing “was declared but never used” error.
In my current project, these unused parameters are necessary and even if they’re errors, they’re not supposed to stop the whole app from starting. I see this is a problem from typescript.
So Angular needs that ‘search =>’ to run search filter… but typescript detects it as an unused parameter. In case you guys see this error, you can turn off error detector in tsconfig.json file.