这是参考损坏代码的小提琴。当我尝试它时,它应该发送到的服务器没有响应,这让我相信它没有从我的应用程序接收任何流量。问题明显吗?如果不是,我可以使用哪些故障排除方法来调查问题?
stackoverflow 希望我包含我的内联代码,所以就在这里。
index.html
<div ng-controller="DataEntryCtrl">
<form ng-repeat="entryField in entryFields">
<input type="text"
ng-model="entryField.fieldData"
placeholder="{{entryField.pHolder}}">
</form>
<input type="button" ng-click="sendJSON()" value="Object To JSON" />
<hr/>
{{res}}
<ul>
<li>ID: {{entryFields.id.fieldData}}</li>
<li>description: {{entryFields.description.fieldData}}</li>
<li>date: {{entryFields.date.fieldData}}</li>
</ul>
</div>
controller.js
'use strict';
/* Controllers */
var app = angular.module('Hubbub-FrontEnd', ['ngResource']);
app.controller('DataEntryCtrl', function($scope,$resource) {
$scope.entryFields = {
id: {pHolder:'ID goes here',fieldData:""},
description: {pHolder:'Description goes here',fieldData:""},
date: {pHolder:'Drop Dead Date goes here',fieldData:""}
};
$scope.showJSON = function() {
$scope.json = angular.toJson($scope.entryFields);
};
$scope.sendJSON = function() {
$scope.entry = angular.toJson($scope.entryFields);
$scope.res = $resource('http://10.64.16.6:3000/Create',
{create:{method:'POST'}},{params:$scope.entry});
};
});