JSFiddle - React, Tailwind, and code Playground
by lukempeters
HTML
<h2>{{pollQuestion}}</h2>
JavaScript
function PollCtrl($scope, $http)
{
$scope.pollQuestion = 'Why?';
$scope.savePoll = function()
{
$scope.newPoll = {
question: $scope.pollQuestion,
answers: [$scope.pollAnswer1, $scope.pollAnswer2, $scope.pollAnswer3, $scope.pollAnswer4, $scope.pollAnswer5]
};
$http({
url: baseUrl + 'api/save_poll.php',
method: 'POST',
params: $scope.newPoll,
}).success(function (data) {
console.log(data);
});
};
}