Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="The .dot rule - controller as" />
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body ng-app="app">
  <div class="controller" ng-controller="ParentController as parent">
    ParentController: <input type="text" ng-model="parent.foo" />
    foo: {{ parent.foo }}
    <div class="controller" ng-controller="ChildController as child">
      ChildController: <input type="text" ng-model="parent.foo" />
      foo: {{ parent.foo }}
  </div>
</div>
</body>
</html>
 
angular.module('app',[])
    .controller('ParentController', ParentController)
    .controller('ChildController', ChildController);
    
function ParentController($scope) {
    this.foo = "bar";
}
function ChildController() {
}
Output

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

Dismiss x
public
Bin info
yanivefraimpro
0viewers