Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body ng-app="xmp">
  
  <div ng-controller="MainCtrl">
    <input type="text" ng-model="myVar.data">
  </div>
  <div ng-controller="SearchCtrl">
    <h1>{{myVar.data}}</h1>
  </div>
  
</body>
</html>
 
var xmp = angular.module('xmp', []);
xmp.factory("myService", function(){
  return {
    sharedObject: { data: 'Joe' }
  }; 
  
});
 
function MainCtrl($scope, myService) {
  $scope.myVar = myService.sharedObject;
}
function SearchCtrl($scope, $http, myService) {
  $scope.myVar = myService.sharedObject;
}
Output

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

Dismiss x
public
Bin info
hitautodestructpro
0viewers