Angularjs - 交换范围数据下的ng-model不绑定

时间:2017-11-09 06:31:09

标签: javascript php html angularjs json

<div class="row" ng-switch on="patienttype">
<hr>
  <div class="col-lg-4">
    <div class="panel-body" ng-switch-when="Outpatient">
      <div class="form-group">
         <label>Attending Physician</label>
         <input type="text" placeholder="Dr. Juan Dela Cruz" ng-model="attendingdoctor">
      </div>
    </div>
  </div>
</div>

我试图做一个angularjs帖子,但是在做帖子时输入数据并没有绑定到模型。这是控制器的代码

$scope.Register = function() {
      $http.post("http://localhost/Metro Lipa Patient System/metro-lipa-pages/patient-details.php", {
           'attendingdoctor': $scope.attendingdoctor
           }).then(function(response){
           window.location.href = 'index.php'
           });
  };

我做错了什么可能是什么?

这是发布数据后的PHP脚本

<?php
require_once '../assets/connection.php';

$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$attendingdoctor = addslashes($request->attendingdoctor);

?>

0 个答案:

没有答案