Learn the powerful enterprise adaptable database:

Getting Started With ADABAS & Natural

Wednesday, March 2, 2016

TP104-AngularJS Controllers


TP104-AngularJS Controllers
code examples:

<html>

   <head>
      <title>Angular JS Controller</title>
      <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
   </head>

   <body>
      <h2>AngularJS Sample Application</h2>
   
      <div ng-app = "mainApp" ng-controller = "studentController">
         Enter first name: <input type = "text" ng-model = "student.firstName"><br><br>
         Enter last name: <input type = "text" ng-model = "student.lastName"><br>
         <br>
     
         You are entering: {{student.fullName()}}
      </div>
   
      <script>
         var mainApp = angular.module("mainApp", []);
     
         mainApp.controller('studentController', function($scope) {
            $scope.student = {
               firstName: "Mahesh",
               lastName: "Parashar",
           
               fullName: function() {
                  var studentObject;
                  studentObject = $scope.student;
                  return studentObject.firstName + " " + studentObject.lastName;
               }
            };
         });
      </script>
   
   </body>
</html>



ref: https://www.tutorialspoint.com/angularjs/angularjs_controllers.htm

201603

No comments:

Post a Comment