Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Material Angular, how to add an attribute to a md-text-float directive

I use material.angular for my user formular, the input "name" is like that :

<md-text-float label="Username" ng-model="userEdit.user.nickname"></md-text-float>

And I want to add the "required" attribute to the input previously created, but it seems to be hard, material allow me to specify a type or the "disabled" attr but nothing else.

Can I add an attribute after the creation of the field ?

like image 729
TO MA Avatar asked Jan 17 '26 10:01

TO MA


1 Answers

You can now use the 'required' attribute on <md-text-float> element,

It's working on version v0.6.1-master-fc723d4

If you need other attributes to pass along to your <input> element, you could use the following:

<md-input-group class="md-default-theme">
   <label for="">something </label>
   <md-input  ng-model="myValue" ng-change="doSomethingOnChange()"  ng-blur="doSomethingOnBlur()" autocapitalize="off" type=""></md-input>
</md-input-group>

a working codepen

see this discussion on github

like image 159
Nitsan Baleli Avatar answered Jan 20 '26 22:01

Nitsan Baleli