Angular: Empty Fiddle
http://angularjs.org/
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="TestController">
Before Editing: {{preEdit}}<br>
After Editing: {{postEdit}}<br>
</div>
<div ng-controller="SampleController">
In another Controller: {{transferedValue}}
</div>
JavaScript
var myApp = angular.module('myApp',[]);
myApp.value("basePath", "");
//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});
myApp.controller('TestController', function($scope, basePath) {
$scope.preEdit = basePath;
basePath = window.location.href;
$scope.postEdit = basePath;
});
myApp.controller('SampleController', function($scope, basePath) {
$scope.transferedValue = basePath;
})