Abhishek Jadhav
Abhishek Jadhav

Reputation: 129

How to use ng-if and ng-blur together?

 <input kendo-time-picker
        name="ArriveDateTime"
        class="form-control"
        k-format="'hh:mm tt'"
        k-parse-formats="['hh:mm tt']"
        k-ng-model="technician.ArriveDateTime"
        k-ng-disabled="!technician.IsLocked"
        ng-blur="Actions.OnChangeTime()"/>

I want to use ng-blur on specific conditions. I have added variable in controller named as $scope.Variables.isFormSubmitted which may be true or false.I want to call action on blur only if $scope.FormSubmitted is true. So how can I check the condition first and then use ng-blur? Thanks in advance!!!!

Upvotes: 0

Views: 3220

Answers (2)

Syam Pillai
Syam Pillai

Reputation: 5217

Include condition inside ng-blur

ng-blur="Variables.isFormSubmitted ? Actions.OnChangeTime(): doSomethingElseOr keepEmpty()"

Upvotes: 1

schacki
schacki

Reputation: 9533

Just rewrite the expression like this:

ng-blur="Variables.isFormSubmitted && Actions.OnChangeTime()"

Upvotes: 2

Related Questions