Nucleus gives a place to live for
all its components. For managing their life span, it uses a variable named "scope"
for all its components. As, it is a nucleus property, it is preceded by $ sign.
- Global: Component is shared among all users.
- Session: Separate instances of the component are provided to each user.
- Request: Separate instances of the component are provided to each active request.
Specifying
component scopes
You specify a component’s scope by
setting its $scope
property to global,
session, or request. For example, a NewPerson component might be set to session
scope as follows:
$class=Person
$scope=session
name=Bill
age=28
$scope=session
name=Bill
age=28
Note: If a component’s $scope property is not explicitly set, it automatically has global
scope.
A component’s properties should always point to objects
whose scope is equal to or greater than its own. Thus, global-scope component properties should only point to objects that
also have global scope; session-scope component properties should only point to
objects that have global or session scope; while request-scope component
properties can point to objects of any scope, including request.
1 comments:
You specify a component’s scope by setting its $scope property to global, session, request, or window. For example, a NewPerson component might be set to session scope as follows:
$class=Person
$scope=session
name=Bill
age=28 If a component’s $scope property is not explicitly set, it automatically has global scope.
Post a Comment