angular / material

Material design for AngularJS
https://material.angularjs.org/
MIT License
16.55k stars 3.39k forks source link

value in input[text] with ng-value not automatically show #6309

Closed AhmadZuhdi closed 8 years ago

AhmadZuhdi commented 8 years ago

value in input[text] is not automatically show if value is set with ng-value, it need to focus first

angular-material-ng-value-input-text

HTML

<md-input-container>
  <label>Name (ng-value)</label>
  <input type="text" ng-value="name">
</md-input-container>
<md-input-container>
  <label>Name (ng-model)</label>
  <input type="text" ng-model="name">
</md-input-container>
<md-input-container>
  <label>Name (value)</label>
  <input type="text" value="John Doe">
</md-input-container>

Javascript

$scope.name = 'Tasks';

versions

angular#1.4.8
angular-material#1.0.0-rc7
joezirilli commented 8 years ago

+1

EladBezalel commented 8 years ago

@AhmadZuhdi Can you please provide a codepen so we can investigate more?

AhmadZuhdi commented 8 years ago

@EladBezalel like this http://codepen.io/AhmadZuhdi/pen/wMdEyw ?

EladBezalel commented 8 years ago

yes thank you :) i'm on it..

EladBezalel commented 8 years ago

@AhmadZuhdi ngValue shouldn't be used on text input.

j86 commented 8 years ago

Thanks for getting round to this issue @EladBezalel . Do you have a suggestion how to pre-populate a text input if not using ngValue?

EladBezalel commented 8 years ago

controller is the best solution, ng-init might work as well