I would like to use materializecss without jQuery. For example, I want to do the following without the use of jQuery:
$('.chips-initial').material_chip({
data: [{
tag: 'Apple',
}, {
tag: 'Microsoft',
}, {
tag: 'Google',
}],
});
Thanks
Since version 1.0.0 you can.
const elem = document.querySelector('.chips');
const instance = M.Chips.init(elem, options);
List of possible options for the chips.
For Angular2+ you'll need:
npm install materialize-css
In package.json
"dependencies": {
"materialize-css": "^1.0.0-alpha.4",
}
or later version.
In .angular-cli.json
"styles": [
"../node_modules/materialize-css/dist/css/materialize.css"
],
"scripts": [
"../node_modules/materialize-css/dist/js/materialize.js"
],
And to be able to use M object in your components, simply add to the imports
declare const M: any;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With