没有显示在控制台窗口和“网络”选项卡中

时间:2018-08-30 19:52:40

标签: html angularjs post console.log

第二部分是html代码,第一部分是angularjs部分。

customer.controller("new_info", 
  function($scope, $routeParams,$http)
  {    
    $scope.customer = {};
    $scope.register = function () {
      $http.post('localhost:4000/new_info', $scope.customer).then(
        function (response) { 
          console.log("posted successfully"); //not showing anything in the console window
        }
    );
  }
});
<div class="col-md-6">
        <div class="panel-body">
            <form name="AddCustomer"  >
                <div class="form-group">
                    <label>Id</label>
                    <input type="text" class="form-control" ng-model="customer.id" />
                </div>
                <div class="form-group">
                    <label>Name</label>
                    <input type="text" class="form-control" ng-model="customer.name" />
                </div>
                <div class="form-group">
                    <label>City</label>
                    <input type="text" class="form-control" ng-model="customer.city" />
                </div>
                <button  class="btn btn-default" ng-click="register()">Submit</button> 
            </form>
        </div>
</div>
    

//单击按钮后,它什么都没有显示。

0 个答案:

没有答案
相关问题