Sunday, 20 December 2015

html and php input form using angular.js

you can submit input field without page refresh using html , php , angular js

[This example is submit html check box and without page refresh]

angular.min.js

index.php


<!DOCTYPE html>
<html>
<head>
    <script src="angular.min.js"></script>
</head>

<body ng-app="myapp">

<div ng-controller="MyController" >
    <form>

        <input class="singleRoom" type="checkbox" name="firstName" ng-model="myForm.firstName"  ng-true-value="YES" ng-false-value=" " /> First name <br/>

    </form>

    <div>

<?php
       $a=" {{myForm.firstName}} ";
  
  echo $a;   ?>

    </div>
</div>

<script>
    angular.module("myapp", [])
            .controller("MyController", function($scope) {
                $scope.myForm = {};
                
            } );
</script>

</body>
</html>

No comments:

Post a Comment