1
<input type="text" name="input" ng-model="email" placeholder="Email ID"/>
<!--input text box which value is send when click event fire.-->
<button type="submit" id="Button1" ng-click="sendBtnForgotPswd(email)" />
</form>

I don't want to fire click event when input "email" is undefined. Any in built filter provide by AngularJS for prevent click event*

1

2 Answers 2

2

You have at least two possibilities here. Probably optimal one is to use ngDisabled directive to deactivate button when email is empty:

<button ng-disabled="!email" ng-click="sendBtnForgotPswd(email)" 
        type="submit" id="Button1" >Send</button>

Other option is to call sendBtnForgotPswd function only when email is filled in:

<button type="submit" id="Button1" ng-click="email && sendBtnForgotPswd(email)">Send</button>

Also note that button tag cannot be self-closable so you should add closing </button>.

Sign up to request clarification or add additional context in comments.

Comments

1

Use ng-disabled="!email" on the button element.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.