chonglawr
chonglawr

Reputation: 211

How can have an ng-if two way conditionality within a button?

I have a button that I would like to not autofocus on a textfield if the browser is Internet explorer. There are other ids and various things in the button element I didn't include. I know I could include two separate ng-if statements and repeat both pieces of button classes from the outside, one with and one without forcefoucus.

Is there a possible way of putting the ng-if inside the button tag so I wouldn't need to repeat the other stuff in the button tag?

Non IE

<button type="button"
    otherStuff
    ng-click="doStuff(); forceFocus('currentPassword')"  
</button>

IE

<button type="button"
    otherStuff
    ng-click="doStuff()"  
</button>

Upvotes: 0

Views: 30

Answers (1)

in your forceFocus function add one more parameter: isInternetExp. So that you can return false if isInternetExp value is true

forceFocus('currentPassword', isInternetExp)

Upvotes: 1

Related Questions