Define two values in scope

Description

The following code shows how to Define two values in scope.

Example


<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.9.1.js'></script>
<script type='text/javascript'>
    function DemoCtrl($scope)<!--from w  w  w. j av  a2  s  .c o  m-->
    {
        $scope.firstName = "Steve";
        $scope.lastName = "Smith";
    }    
</script>
</head>
<body>
  <div ng-app>
    <div ng-controller="DemoCtrl">
        Hi, {{firstName}} {{lastName}}!
    </div>
</div>
</body>
</html>

Click to view the demo





















Home »
  AngularJS »
    AngularJS Example »




Controller
Directives
Expression
Filter
Form
Inject
Scope
Server
Style
Template
Utilities