Angular-materialize
This is a collection of simple angular directives for using the features in materializecss.
Input-field
Materialize uses the class .input-field to manage animating labels and input-fields. But that doesn't work properly when angular dynamically creates element
Instead of adding the class input-field, use the input-field directive. This way it still works when angular dynamically creates it.
<div input-field>
<input type="text" ng-model="dummyInputs.inputFieldInput">
<label>Input label</label>
</div>
You can also use it as an element instead of an attribute.
<input-field>
<input type="text" ng-model="dummyInputs.inputFieldInput">
<label>Input label</label>
</input-field>
Material select
Add the material-select as an attribute to the select where you want material-select.
Not needed if you add the class browser-default.
It doesn't support changing content within the select, add the class browser-default if you want that.
You selected: {{select.value1}}
<select class="" ng-model="select.value1" material-select>
<option ng-repeat="value in select.choices">{{value}}</option>
</select>
Using class browser-default
You selected: {{select.value2}}
<select class="browser-default" ng-model="select.value2">
<option ng-repeat="value in select.choices">{{value}}</option>
</select>
Toasts
Materializes toast is a global function. Using this directive you can call a toast using a custom event (in the below click), and show a message determined by a variable in the scope.
<div class="row">
<div class="col s4" input-field>
<input id="message" type="text" ng-model="dummyInputs.message">
<label for="message">Message</label>
</div>
<div class="input-field col s4">
<a class="waves-effect waves-light btn" data-message="{{ dummyInputs.message }}" toast='click'>Toast!</a>
</div>
</div>
Dropdown
The dropdown attribute in the below makes sure that the jQuery plugin is run.
You can set attributes on the tag, matching the names of the options in the materializeCSS's version.
<!-- Dropdown Trigger -->
<a class='dropdown-button btn' href='javascript:void(0);' data-activates='demoDropdown' dropdown data-hover="true">
This is a dropdown
</a>
<!-- Dropdown Structure -->
<ul id='demoDropdown' class='dropdown-content'>
<li><a href="javascript:void(0);">Link 1</a></li>
<li><a href="javascript:void(0);">Link 2</a></li>
<li><a href="javascript:void(0);">Link 3</a></li>
<li><a href="javascript:void(0);">Link 4</a></li>
<li><a href="javascript:void(0);">Link 5</a></li>
</ul>
<a href="#" class="button-collapse" data-activates="nav-mobile" data-sidenav="left" data-menuwidth="500" data-closeonclick="false">
Show side-nav
</a>