Closed dbarison closed 7 years ago
To get this working I had to turn off turbolinks. It still didn't work until I changed my application.js file.
I had to change: //= require materialize-sprockets
to
//= require materialize
This is related to Materialize.updateTextFields
not being defined until turbolinks:load
is fired. I've adjusted forms.js
in a fork to define this outside that scope, though I'm not 100% sure that's the correct solution.
https://github.com/sitehive/materialize-sass/blob/master/app/assets/javascripts/materialize/forms.js
I've also added Materialize.initializeForms
for use manually in dynamic generated content, and am calling that on Turbolinks load.
Disabling Turbolinks and changing to //= require materialize
above will pull in the original minified library and fix most of these (though Forms still can't be dynamically initialized.)
Proposed a PR that should fix this:
put a ngClass in your label like this
<label for="name" [ngClass]="{'active': user.name }">Name
https://github.com/Dogfalo/materialize/issues/3914