Skip to main content

Posts

Showing posts with the label angularjs Scope Inheritance

What are scope and scope inheritance?

Scope :  Click for live demo The scope is an object of JavaScript. The scope is provide the connection between controller to view. The model data contain by the scope and all the model data access by the $scope. i.e. //assign value in scope and access it. var parentApp = angular.module( "myParentApp" , []);   parentApp.controller( "MyParentController" , [ '$scope' , function ($scope) {      $scope.name = 'Anil Singh' ;      $scope.Age = 30;    } }]); //assign value in scope and access it. var parentApp = angular.module("myParentApp", []); parentApp.controller("MyParentController", ['$scope', function ($scope) { $scope.name = 'Anil Singh'; $scope.Age = 30; } }]); Scope Inheritance : The Scope Inheritance work like JavaScript Inheritance. The parent scope and child scope attached with taggers. By default, The child scope prototype inherit from the parent scope...