0

I have one button that have ng-click, like this

 <button type="button" class="btn btn-primary pull-right push-right-5" role="button" ng-click="model.assignToProjects()">GO</button>

What i need is to add new action to ng-click, like this

ng-click="submitted=true"

The problem is i have application that is to big and i need to have some common event that will do first event, if it is valid allow second event, that can be anything :( Here how my HTML should look like

 <button type="button" class="btn btn-primary pull-right push-right-5" role="button" ng-click="submitted=true ; model.assignToProjects();">GO</button>

Is it possible to do this way or i must rewrite my entire logic :(

12
  • First of all you have to validate form before calling a submit function. Commented Aug 8, 2016 at 10:05
  • Yes but i need to show error messages when button is clicked , but now click go bypass validation Commented Aug 8, 2016 at 10:07
  • in a validation function you have to return true or false. if it return false then populate error before calling submit function. Commented Aug 8, 2016 at 10:09
  • You can see there is no submit just ng-click, and i dont know what function can be on ng-click, except i need to add validation before that function Commented Aug 8, 2016 at 10:10
  • In controller write a function name $scope.submit = function () { var validate = true if(validate=true) then perform action else show error} Commented Aug 8, 2016 at 10:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.