How to send this data in AngularJS. (It's a multiple array in a multiple array which need to send on one Object)
[{
"working_day":"sunday",
"from_time":{"hour":"9","min":"30"},
"to_time":{"hour":"6","min":"30"}
},{
"working_day":"monday",
"from_time":{"hour":"9","min":"30"},
"to_time":{"hour":"6","min":"30"}... and so on for other week days
}]
I am trying to send data like this in an API and I am new to AngularJs, so please tell me how can I make this data through HTML at runtime?
$scope.schedule = []; // Hard coded value
$scope.week = {};
$scope.week.working_day = "Sunday";
$scope.week.from_time = {};
$scope.week.from_time.min = "10:00";
$scope.week.from_time.max = "5:00";
$scope.week.to_time = {};
$scope.week.to_time.min = "2:10";
$scope.week.to_time.max = "8:00";
var dataParam = {
"prefix":$scope.data1.prefix,
"first_name":$scope.data1.first_name,
"password":$scope.data1.password,
"last_name":$scope.data1.last_name,
"email_id":$scope.data1.email_id,
"mobile_number":$scope.data1.mobile_number,
"roleCode":[$scope.data1.roleCode],
"role":[$scope.data1.role],
"Schedule":angular.toJson($scope.schedule.push($scope.week))
}
console.log(angular.toJson(dataParam));
/* $http({
url: "/here",
method: "POST",
headers :{'Content-Type': 'application/json','Accept': 'application/json' },
data: dataParam
}) .success(function(response) {
if(response.status_code=="success")
{
$scope.successmsg = response.status_message;
console.log(angular.toJson(response));
$state.go('dashboard.setting.user', {'user': $scope.viewUser});
}
else {
$scope.successmsg = response.status_code;
}
}); */
};
for now i just need to send this data format with angular js, please suggest
this is what i am doing in angular by "hard code" i need to send this data in angular js, how can i do that?
now please help me with html code of angular to send that hard coded value into runtime value by user
$http
service DOC