AngularJS Tutorial - Define two values in scope








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)<!--   w w w .j a v  a 2s  .  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>

The code above is rendered as follows: