I have the following input html element that I want to change the placeholder of depending on what is being held in my user model.
<input type="text" class="form-control" id="Username" name="Username" data-ng-model="user.Username" required="" ng-placeholder="{{user.AdAccount ? 'Username' : 'Ad Login'}}">
I even tried this method that is said to have worked in previous versions of angular, but no success.
ng-placeholder="user.AdAccount == true && 'Username' || 'AD Login'"
At the moment my placeholder just appears completely blank. I also know that AdAccount is holding true/false correctly because it is being used elsewhere on the form with ng-show.
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-placeholder
into just placeholder
, and everything should work fine.
(Note also the self-closing slash if you need to conform to valid XHTML.)