Create a form with an input field. Bind the input value to a variable and display it below the form using angular js

<div ng-app="myApp" ng-controller="MyController">
    <form>
        <label>Enter your name:</label>
        <input type="text" ng-model="userName">
    </form>
    <p>Your name is: {{ userName }}</p>
</div>

<script>
    var app = angular.module('myApp', []);
    app.controller('MyController', function($scope) {
        $scope.userName = '';
    });
</script>

 

Post your Answer