Learn the powerful enterprise adaptable database:

Getting Started With ADABAS & Natural

Wednesday, March 2, 2016

TP113-AngularJS Scopes


TP113-AngularJS Scopes
code examples:

<html>
   <head>
      <title>Angular JS Forms</title>
   </head>
 
   <body>
      <h2>AngularJS Sample Application</h2>
   
      <div ng-app = "mainApp" ng-controller = "shapeController">
         <p>{{message}} <br/> {{type}} </p>
       
         <div ng-controller = "circleController">
            <p>{{message}} <br/> {{type}} </p>
         </div>
       
         <div ng-controller = "squareController">
            <p>{{message}} <br/> {{type}} </p>
         </div>

      </div>

      <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
   
      <script>
         var mainApp = angular.module("mainApp", []);
       
         mainApp.controller("shapeController", function($scope) {
            $scope.message = "In shape controller";
            $scope.type = "Shape";
         });
       
         mainApp.controller("circleController", function($scope) {
            $scope.message = "In circle controller";
         });
       
         mainApp.controller("squareController", function($scope) {
            $scope.message = "In square controller";
            $scope.type = "Square";
         });

      </script>
   
   </body>
</html>



https://www.tutorialspoint.com/angularjs/angularjs_scopes.htm

201603

No comments:

Post a Comment