Angularjs 角度js ng提交不工作

Angularjs 角度js ng提交不工作,angularjs,Angularjs,我目前一直在提交表格。我认为我的工作不正常。我试着在chrome上运行,但在firefox上,一切都不起作用。似乎有点困惑 这是我的密码: //控制器 app.controller("HomeController",["$scope","suggestions",function($scope,suggestions){ $scope.posts = suggestions.posts; $scope.addSuggestion = function(){ //if input empty

我目前一直在提交表格。我认为我的工作不正常。我试着在chrome上运行,但在firefox上,一切都不起作用。似乎有点困惑 这是我的密码:

//控制器

app.controller("HomeController",["$scope","suggestions",function($scope,suggestions){
$scope.posts = suggestions.posts;

$scope.addSuggestion = function(){
  //if input empty
  if(!$scope.title || $scope.title === ""){
    alert("wrong");
  }

  //push suggestions
  $scope.posts.push({
    title: $scope.title,
    upvotes: 0

  });

  //after submit, clear input
  $scope.title = "";
};
}]);
//html

<body ng-app="SuggestionBox" ng-controller="HomeController">
<h1 class="text-center">Suggestion Box</h1>
<section id="main">
  <div class="container">
    <div class="row">
      <div class="col-md-6 col-md-offset-3">
        <div class="well" ng-repeat="post in posts | orderBy:'-upvotes'">
          <h3>{{post.title}}</h3>
          <button type="button" class="btn btn-warning"><i class="fa fa-star"></i> {{ post.upvotes }}</button>
        </div>
      </div>
    </div>

    <div class="row">
      <div class="col-md-6 col-md-offset-3">
        <form ng-submit="addSuggestion()">
          <h3 class="text-center">Submit Your Suggestion</h3>
          <div class="form-group">
            <input type="text" class="form-control" placeholder="Great Ideas Here" ng-model="title"/>
          </div>
          <button type="submit" class="btn btn-primary">Suggest</button>
        </form>
      </div>
    </div>
  </div>
</section>

建议箱
{{post.title}
{{post.upvoces}}
提交你的建议
暗示
试试这个。。
暗示
//换行-
希望它能起作用。

依赖项建议给您带来了问题。

无论如何,“建议”是我的服务,因此我获取并存储在它上。您能提供此建议服务中编写的代码吗?嘿,它工作了!!谢谢,但为什么它使用输入按钮来工作呢?你们看过浏览器开发者控制台吗?
try this..

<button type="submit" class="btn btn-primary">Suggest</button>
//change this line-
<input type="submit" class="btn btn-primary" name="" id="" value="Suggest" />

hope it works.
<html lang="en">

<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
<script>
    angular.module('SuggestionBox', []).controller("HomeController", ["$scope", function($scope) {
        $scope.posts = [];

        $scope.addSuggestion = function() {
            //if input empty
            if (!$scope.title || $scope.title === "") {
                alert("wrong");
            }

            //push suggestions
            $scope.posts.push({
                title: $scope.title,
                upvotes: 0

            });

            //after submit, clear input
            $scope.title = "";
        };
    }]);
</script>
</head>

<body ng-app="SuggestionBox" ng-controller="HomeController">
<h1 class="text-center">Suggestion Box</h1>
<section id="main">
    <div class="container">
        <div class="row">
            <div class="col-md-6 col-md-offset-3">
                <div class="well" ng-repeat="post in posts | orderBy:'-upvotes'">
                    <h3>{{post.title}}</h3>
                    <button type="button" class="btn btn-warning"><i class="fa fa-star"></i> {{ post.upvotes }}</button>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-md-6 col-md-offset-3">
                <form ng-submit="addSuggestion()">
                    <h3 class="text-center">Submit Your Suggestion</h3>
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="Great Ideas Here" ng-model="title" />
                    </div>
                    <button type="submit" class="btn btn-primary">Suggest</button>
                </form>
            </div>
        </div>
    </div>
</section>
</body>

</html>
app.controller("HomeController",["$scope","suggestions",function($scope,suggestions){