AngularJS: ng-placeholder not working

梦想与她 提交于 2019-12-05 00:22:06

I don't think there's any ngPlaceholder directive. Try changing your code to:

<input type="text" class="form-control" id="Username" name="Username" data-ng-model="user.Username" required="" placeholder="{{user.AdAccount ? 'Username' : 'Ad Login'}}" />

That is, change ng-placeholderinto just placeholder, and everything should work fine.

(Note also the self-closing slash if you need to conform to valid XHTML.)

Hussain

You can try this:

<input type="text" class="form-control" id="Username" name="Username" data-ng-model="user.Username" required="" ng-attr-placeholder="{{user.AdAccount ? 'Username' : 'Ad Login'}}">

ng-attr- will work with any HTML attribute.

Abhishek Saxena

In HTML:

<input type="text" placeholder="{{doctorname ? doctorname : 'Dr. your name'}}"
       class="editable-class" ng-model="doctor.name" readonly/>

In controller:

$scope.doctorname = $scope.doctorinfo.name;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!