Simple AngularJS 2

Simple AngularJS with model and output

by Narendra Vishwakarma

HTML

<div ng-app="app">
    <p>Try to change the names.</p>
    <div ng-controller="personController">
        <p>First Name:
            <input type="text" ng-model="firstName" />
        </p>
        <p>Last Name:
            <input type="text" ng-model="lastName" />
        </p>
        <p>Full Name: {{firstName}} {{lastName}}</p>
    </div>
</div>

JavaScript

angular.module("app", []).controller("personController", function ($scope) {
    $scope.firstName = "John";
    $scope.lastName = "Doe";
});