Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!doctype html>
<html ng-app>
  <head>
    <script src="http://code.angularjs.org/1.2.8/angular.js"></script>
    <style type="text/css">
    .selected {
      background-color: lightgreen;
    }
    </style>
  </head>
  <body>
    <div ng-controller="ParentController">
      <div>
        Ship staff: {{firstName}} {{lastName}} and {{crewmen}} crewmen.
      </div>
      <div ng-controller="ChildController">
        Ship staff: {{firstName}} {{lastName}} and {{crewmen}} crewmen.
      </div>
    </div>
    <script>
    function ParentController($scope) {
      $scope.firstName = 'Captain';
      $scope.lastName = 'Nemo';
      $scope.crewmen = 30;
    }
    function ChildController($scope) {
      console.log(this);
      console.log($scope);
      this.lastName = 'Columbus';
      this.crewmen = $scope.crewmen + 56;
    }
    </script>
  </body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers