• PHP
  • Core Java
  • SQL Tutorial
  • JavaScript
  • Struts
  • Java IO
  • RubyonRails
  • Servlet
  • JSP

  • <

    AngularJS Scopes

    The scope is the binding part between the HTML (view) and the JavaScript (controller).

    The scope is an object with the available properties and methods.

    The scope is available for both the view and the controller.

    Use of Scope



     <!DOCTYPE html>  
    <html>  
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>  
    <body>  
    <div ng-app="myApp" ng-controller="myCtrl">  
    <h1>{{carname}}</h1>  
    </div>  
    <script>  
    var app = angular.module('myApp', []);  
    app.controller('myCtrl', function($scope) {  
        $scope.carname = "Volvo";  
    });  
    </script>  
    <p>The property "carname" was made in the controller, and can be referred to in the view by using the {{ }} brackets.</p>  
    </body>  
    </html>  
    
    
    
















    © copyright 2017-2021 Completedone pvt ltd.