我是AngularJS的新手,我想在按钮ng-click
上调用注册方法,但它永远不会被调用。
<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>
答案 0 :(得分:1)
试试这个
<button ng-click="signup()" class="form-control btn btn-primary">Sign-Up</button>
在你的情况下,$ parent没有方法注册