如何提取Angular.js表单请求独立工作?

时间:2015-11-21 17:45:13

标签: angularjs

如果在使用Angular的网站上有POST请求表单。如何提取可以通过jQuery或PostMan等工作并检索响应的独立POST请求。

如果我们有这个运行Angular站点代码:

<form ng-submit="submit(form)" name="$parent.accounts" novalidate="" class="ng-pristine ng-invalid ng-invalid-required">
   <!-- ngIf: status && status !== 200 -->
   <div class="row" ng-class="{'has-error': (accounts.username.$dirty &amp;&amp; accounts.username.$invalid)}">
      <div class="col-xs-12">
         <label for="login-username" class="control-label sr-only ng-binding">Username</label><input ng-model="form.username" type="text" class="form-control input-with-feedback ng-pristine ng-valid ng-valid-required ng-valid-sp-disallow-chars" name="username" id="login-username" placeholder="Username" required="" sp-disallow-chars=":%&amp;'`´&quot;" sp-disallow-chars-model="usernameDisallowedChars" autocapitalize="off" autocomplete="off" autocorrect="off" autofocus="autofocus" ng-trim="false"><!-- ngIf: accounts.username.$dirty && accounts.username.$invalid -->
      </div>
   </div>
   <div class="row" ng-class="{'has-error': (accounts.password.$dirty &amp;&amp; accounts.password.$invalid)}">
      <div class="col-xs-12">
         <label for="login-password" class="control-label sr-only ng-binding">Password</label><input ng-model="form.password" type="password" class="form-control input-with-feedback ng-pristine ng-invalid ng-invalid-required" name="password" id="login-password" placeholder="Password" required="" autocomplete="off" ng-trim="false"><!-- ngIf: accounts.password.$dirty && accounts.password.$invalid -->
      </div>
   </div>
   <div class="row row-submit">
      <div class="col-xs-12 col-sm-6">
         <div class="checkbox"><label class="ng-binding"><input ng-model="form.remember" type="checkbox" name="remember" id="login-remember" class="ng-pristine ng-valid"> Remember me <span class="control-indicator"></span></label></div>
      </div>
      <div class="col-xs-12 col-sm-6"><button class="btn btn-sm btn-block btn-green ng-binding">Log In</button></div>
   </div>
</form>

我们如何才能获得有效的帖子请求数据,例如键,网址等,以使其能够从邮递员那里工作

1 个答案:

答案 0 :(得分:0)

如果您使用的是Chrome,则可以在开发人员工具的Network标签中检查您的浏览器发送的请求。大多数其他浏览器具有类似的功能。打开开发工具的最便携方式可能是右键单击页面上的某个位置并选择Inspect element。这通常会将您转到Elements标签,您可以从那里切换到Network

这就是该面板在Windows上的Chrome中的样子: "Network" tab in Chrome developer tools