JSFiddle - React, Tailwind, and code Playground
by Sajeetharan Sinnathurai
HTML
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js"></script>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
$scope.submit = function() {
var data = {
book: {
author: $scope.author,
title: $scope.title,
body: $scope.body
}
}
$http.post("/", data).success(function(data, status) {
console.log('Data posted successfully');
})
}
});</script>
</head>
<body ng-app="myApp">
<div ng-controller="myCtrl">
<form>
Author:
<input type="text" ng-model="author">
<br>
<br> Title:
<input type="text" ng-model="title">
<br>
<br> Body:
<input type="author" ng-model="body">
<br>
<br>
<input type="submit" value="Submit" ng-click="submit()">
</form>
</div>
</body>
</html>