我有一个问题是它是api结构,这样我就可以根据给定的api发布表单数据
{"data":
{"type":"Open",
"ownership_type":"Agent",
"price":300,
"price_type":"Daily",
"area":40,
"area_unit":"Sq Ft",
"full_address":
{"address":"asasasasasa",
"city":"As",
"state":"saasa",
"zip_code":177820,
"google_location":"sdsdsdsdsd"
},
"description":"sdsdsdsdsdsdsdsds",
"other_features":
["Audience","Display Units","Furninshing"],
"contact_details":
{"name":"Ashsish Ranot",
"email":"asasasasas@asasa.com",
"phone":7878278137
},
"type_of_advertisement":
["ATM","Banner/Poster","Stalls"]
}
}
var app = angular.module('mypropertysubmit', []);
app.controller('submitCtrl', function ($scope, $http) {
$scope.submit_form = function()
{
$http({
url: "http://localhost:3008/api/submit-property",
method: "POST",
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
data: $.param($scope.Property)
}).success(function(data, status, headers, config) {
$scope.status = status;
}).error(function(data, status, headers, config) {
$scope.status = status;
});
}
});
我的玉码是
div(ng-app='mypropertysubmit', ng-controller='submitCtrl')
form
select(ng-model='Property.type')
option(value='Open') Open
option(value='Closed') Closed
select(ng-model='Property.ownership_type')
option(value='Sole Owner') Sole Owner
option(value='Partnership') Partnership
option(value='Agent') Agent
input(type='number', value='0', name='price', ng-model='Property.price')
select(ng-model='Property.price_type')
option(value='Daily') Daily
option(value='Weekly') Weekly
input(type='number', value='0', name='Area', ng-model='Property.area')
select(ng-model='Property.area_unit')
option(value='Daily') Sq Ft.
option(value='Weekly') Sq m.
input(type='text', name='Address', ng-model='Property.contact_details.address')
input(type='text', name='City', ng-model='Property.contact_details.city')
input(type='text', name='state', ng-model='Property.contact_details.state')
input(type='number', value='000000', name='zipcode', ng-model='Property.contact_details.zipcode')
input(type='text', value='000000', name='googlelocation', ng-model='Property.contact_details.googlelocation')
input(type='textbox', name='description', ng-model='Property.description')
input(type='checkbox', value='Audience', ng-model='Property.other_features.audience')
input(type='checkbox', value='Display Units', ng-model='Property.other_features.du')
input(type='checkbox', value='Sound Units', ng-model='Property.other_features.su')
input(type='checkbox', value='Furnishing', ng-model='Property.other_features.f')
input(type='checkbox', value='Air Conditioning', ng-model='Property.other_features.ac')
input(type='text', name='name', ng-model='Property.contact_details.name')
input(type='email', name='email', ng-model='Property.contact_details.email')
input(type='phone', name='phone', ng-model='Property.contact_details.phone')
input(type='checkbox', value='ATM', ng-model='Property.type_of_advertisement.atm')
input(type='checkbox', value='Mobile/Communication Tower', ng-model='Property.type_of_advertisement.mct')
input(type='checkbox', value='Banner/Poster', ng-model='Property.type_of_advertisemen.bpt')
input(type='checkbox', value='Hoarding Board', ng-model='Property.type_of_advertisement.hb')
input(type='checkbox', value='Stalls', ng-model='Property.type_of_advertisement.st')
input(type='checkbox', value='Digital Offine Advertising', ng-model='Property.type_of_advertisement.doa')
input(type='checkbox', value='Area for Display', ng-model='Property.type_of_advertisement.afd')
input(type='submit', ng-click='submit_form()' value='Submit')
但我得到像这样的api结构
{ “状态”: “成功”, “数据”:[{ “_ ID”: “58e0d5566ce6fd2af4cc4670”, “__ V”:0, “DATE_ADD”: “2017-04-02T10:41:26.344Z”,” type_of_advertisement “:[],” other_features “:[]},{” _ ID “:” 58e0d5576ce6fd2af4cc4671" , “__ v”:0, “DATE_ADD”: “2017-04-02T10:41:27.191Z”, “type_of_advertisement”: [], “other_features”:[]},{ “_ ID”: “58e0d5576ce6fd2af4cc4672”, “__ v”:0, “DATE_ADD”: “2017-04-02T10:41:27.291Z”, “type_of_advertisement”:[], “other_features”:[]},{ “_ ID”: “58e0d5576ce6fd2af4cc4673”, “__ v”:0, “DATE_ADD”: “2017-04-02T10:41:27.529Z”, “type_of_advertisement”:[], “other_features” :[]},{ “_ ID”: “58e0d5576ce6fd2af4cc4674”, “__ v”:0, “DATE_ADD”: “2017-04-02T10:41:27.638Z”, “type_of_advertisement”:[], “other_features”:[] },{ “_ ID”: “58e0d5576ce6fd2af4cc4675”, “__ v”:0, “DATE_ADD”: “2017-04-02T10:41:27.904Z”, “type_of_advertisement”:[], “other_features”:[]},{ “_id”: “58e0d5586ce6fd2af4cc4676”, “__ v”:0, “DATE_ADD”: “2017-04-02T10:41:28.106Z”, “type_of_advertisement”:[], “other_features”:[]},{ “_ ID” : “58e0d5a66ce6fd2af4cc4677”, “__ v”:0, “DATE_ADD”:“2017-04-02T10:42:46 .718Z”, “type_of_advertisement”:[], “other_features”:[]},{ “_ ID”: “58e0d5a66ce6fd2af4cc4678”, “__ V”:0, “DATE_ADD”: “2017-04-02T10:42:46.992Z” “type_of_advertisement”:[], “other_features”:[]},{ “_ ID”: “58e0d5a76ce6fd2af4cc4679”, “__ v”:0, “DATE_ADD”: “2017-04-02T10:42:47.157Z”,“type_of_advertisement “:[],” other_features “:[]},{” _ ID “:” 58e0d5a76ce6fd2af4cc467a”, “__ v”:0, “DATE_ADD”: “2017-04-02T10:42:47.179Z”, “type_of_advertisement”:[ ], “other_features”:[]},{ “_ ID”: “58e0d5a76ce6fd2af4cc467b”, “__ v”:0, “DATE_ADD”: “2017-04-02T10:42:47.713Z”, “type_of_advertisement”:[],” other_features “:[]},{” _ ID “:” 58e0d5a76ce6fd2af4cc467c”, “__ v”:0, “DATE_ADD”: “2017-04-02T10:42:47.818Z”, “type_of_advertisement”:[], “other_features”: []},{ “_ ID”: “58e0d5a86ce6fd2af4cc467d”, “__ v”:0, “DATE_ADD”: “2017-04-02T10:42:48.115Z”, “type_of_advertisement”:[], “other_features”:[]} ,{ “_ ID”: “58e0d5a86ce6fd2af4cc467e”, “__ v”:0, “DATE_ADD”: “2017-04-02T10:42:48.224Z”, “type_of_advertisement”:[], “other_features”:[]},{” _id “:” 58e0d5a86ce6fd2af4cc467f “ ”__ v“:0,” date_a DD “:” 2017-04-02T10:42:48.572Z”, “type_of_advertisement”:[], “other_features”:[]},
请帮我按照给出的api发布表单数据