1

I am new in AngularJS, I want to call signup method on button ng-click, but it never gets called.

<div class="row">
<div class="col-sm-5" style="" ng-controller="SignUpController">
 <div class="row">
 <button ng-click="$parent.signup()" class="form-control btn btn-primary">Sign-Up</button>
 </div>
</div>

Angular Script

<script>
 angular.module('index',[])
 .controller('SignUpController', ['$scope', function($scope) {
 $scope.signup=function(){
 alert("");
 };
 }]);
</script>
Rahil Wazir
10.1k11 gold badges46 silver badges66 bronze badges
asked Dec 1, 2014 at 11:15
1
  • Why did you use $parent scope? Commented Dec 1, 2014 at 11:18

1 Answer 1

1

Try this

 <button ng-click="signup()" class="form-control btn btn-primary">Sign-Up</button>

in your case $parent does not have method signup

answered Dec 1, 2014 at 11:16
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.