can't have 2 ng-click on the same page
<p>There are two ng-controller which have one ng-click for each. </p>

<p>If I set the script for two ng-click as the following code, those two buttons will not work. But if I only set the script for either one ng-click, the button works.</p>

<p>How can I solve it?</p>

<pre><code>&lt;body ng-app="myapp"&gt;
    &lt;div ng-controller="loginController"&gt;
        &lt;h3&gt;Login&lt;/h3&gt;
        &lt;form class="login" role="form"&gt;
            &lt;div class="form-group"&gt;
                &lt;label for="email"&gt;Email:&lt;/label&gt;
                &lt;input type="email" class="form-control" id="email" placeholder="Enter email" ng-model="email"&gt;
            &lt;/div&gt;
            &lt;div class="form-group"&gt;
                &lt;label for="pwd"&gt;Password:&lt;/label&gt;
                &lt;input type="password" class="form-control" id="pwd" placeholder="Enter password" ng-model="password"&gt;
            &lt;/div&gt;
            &lt;button type="submit" ng-click="login()" class="btn btn-default"&gt;Login&lt;/button&gt;
        &lt;/form&gt;
    &lt;/div&gt;

    &lt;div ng-controller="registerController"&gt;
        &lt;h3&gt;Register&lt;/h3&gt;
        &lt;form class="register" role="form"&gt;
            &lt;div class="form-group"&gt;
                &lt;label for="email"&gt;Email:&lt;/label&gt;
                &lt;input type="email" class="form-control" id="email" placeholder="Enter email" ng-model="emailR"&gt;
            &lt;/div&gt;
            &lt;div class="form-group"&gt;
                &lt;label for="pwd"&gt;Password:&lt;/label&gt;
                &lt;input type="password" class="form-control" id="pwd" placeholder="Enter password" ng-model="pwdR"&gt;
            &lt;/div&gt;
            &lt;div class="form-group"&gt;
                &lt;label for="name"&gt;Your Name:&lt;/label&gt;
                &lt;input type="text" class="form-control" id="name" placeholder="Enter your name" ng-model="nameR"&gt;
            &lt;/div&gt;
            &lt;button type="submit" ng-click="register()" class="btn btn-default"&gt;Register&lt;/button&gt;
        &lt;/form&gt;
    &lt;/div&gt;

    &lt;script&gt;
        var api = ""

        angular.module("myapp", []).controller("loginController", function($scope, $http) {
            $scope.login = function(){
                if(!isEmpty($scope.email) || !isEmpty($scope.password)){
                    var loginInfo = api + "login/" + $scope.email + "/" + $scope.password;
                    var responsePromise = $http.get(loginInfo);
                    responsePromise.success(function(data, status, headers, config) {
                        var msg = data.result;
                        alert(msg);
                        top.location.reload();
                    });
                    responsePromise.error(function(data, status, headers, config) {
                        alert("AJAX fail!");
                    }); 
                }
            }
        });

        angular.module("myapp", []).controller("registerController", function($scope, $http) {
            $scope.register = function(){
                if(!isEmpty($scope.emailR) || !isEmpty($scope.pwdR || !isEmpty($scope.nameR))){
                    var registerInfo = api + "register/" + $scope.emailR + "/" + $scope.pwdR + "/" + $scope.nameR;                      alert(registerInfo);
                    var responsePromise = $http.get(registerInfo);
                    responsePromise.success(function(data, status, headers, config) {
                        var msg = data.result;
                        alert(msg);
                    });
                    responsePromise.error(function(data, status, headers, config) {
                        alert("AJAX fail!");
                    }); 
                }
            }
        });
</code></pre>