ng- Controller in Angular Js

Sunny.Sagar
Posted by Sunny.Sagar under Others category on | Points: 40 | Views : 559
<div ng-app="  " ng-controller="  ">

First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
<br>
Full Name: {{firstName + " " + lastName}}

</div>

<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.firstName = " ";
$scope.lastName = " ";
});

</script>

In the div ng-app mention your database created app name and cntrl.It displays the names from the database as first name and last name which you provide.

Comments or Responses

Login to post response