Tuesday, November 24, 2015

ng-app and ng-controller


I this case i have manually set may case but in actual this data come from web service
<!DOCTYPE html>
<html>
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<body>



<div ng-app="demoapp" ng-controller="demoCtrl">

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('demoapp', []);
app.controller('demoCtrl', function($scope) {
    $scope.firstName= "abishkar";
    $scope.lastName= "bhattarai";
});
</script>

</body>
</html>

No comments:

Post a Comment