formSelect() method in materialize does’nt work in angular 6 inputs

That’s because you have imported jquery like this:

import * as $ from 'jquery';

try this instead:

$: any // declare dollar sign as a field variable

The reason it should work is when you are importing $ from jquery it looks for formSelect() method in jquery method but it’s a materialize.js method. when you declare $ as an any your code compiles successfully and now because you’ve added jquery and materialize.js to your scripts in your angular.json in the application run it recognizes .formSelect() on $

Leave a Comment