<!DOCTYPE html>
<html>
<head>
<script data-require="angular.js@1.2.18" data-semver="1.2.18" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js"></script>
<script data-require="angular-route@1.2.18" data-semver="1.2.18" src="http://code.angularjs.org/1.2.18/angular-route.min.js"></script>
<script src="script.js"></script>
</head>
<body ng-app="appName">
<h1>Screen transition Sample 01</h1>
<div>
<p>
<a href="#/fromView/">fromView</a> |
<a href="#/toView/">toView</a>
</p>
</div>
<div ng-view></div>
</body>
</html>
// Code goes here
var Globals = Globals || {};
(function () {
angular.module('appName', ['ngRoute'], function($routeProvider) {
$routeProvider
.when('/fromView/', { controller: 'FromViewController', templateUrl: 'FromView.html' })
.when('/toView/' , { controller: 'ToViewController', templateUrl: 'ToView.html' });
});
angular.module('appName').controller('FromViewController', function($scope, $location) {
$scope.buttonClick = function() {
Globals.hoge = 'hoge : ' + new Date().getTime();
$location.path('/toView/');
};
});
angular.module('appName').controller('ToViewController', function($scope) {
$scope.fromViewValue = Globals.hoge;
});
}());
<div>
<h2>From View</h2>
<button ng-click="buttonClick()">Go ToView</button>
</div>
<div>
<h2>To View</h2>
<p>{{fromViewValue}}</p>
</div>