//'use strict';
app = angular.module('myApp', ['ngRoute']);
/* app.config(['$compileProvider', function($compileProvider) {
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|file|ms-appx):/);
alert('config started');
}]); */
app.config(['$routeProvider',function ($routeProvider) {
alert('route start');
//$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|file|ftp|mailto|ghttps?|ms-appx|x-wmapp0):/);
$routeProvider.when('/', {templateUrl: 'FirstView.html', controller: 'mainController'});
$routeProvider.when('/second', {templateUrl: 'SecondView.html', controller: 'secondController'});
$routeProvider.otherwise({redirectTo: '/'});
alert('route end');
}],function($sceDelegateProvider){
$sceDelegateProvider.resourceUrlWhitelist(['.*']);
});
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>Win8Phone</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
<!--
<link rel="shortcut icon" href="images/favicon.png">
<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
-->
<link rel="stylesheet" href="css/main.css">
<!-- <script src="js/winstore-jscompat.js"></script> -->
<!-- <script>window.$ = window.jQuery = WLJQ;</script> -->
<script data-require="angular.js@1.2.x" src="https://code.angularjs.org/1.2.21/angular.js" data-semver="1.2.21"></script>
<!-- <script src="angular-resource.js"></script> -->
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular-route.js"></script>
<script src="app.js"></script>
<!-- <script src="routes.js"></script> -->
<script src="mainController.js"></script>
<script src="secondController.js"></script>
</head>
<body>
<!--application UI goes here-->
<div ng-view></div>
<!-- <script src="js/initOptions.js"></script>
<script src="js/main.js"></script>
<script src="js/messages.js"></script> -->
</body>
</html>
/* Put your css in here */
app.controller('mainController',function($scope){
alert('MainController start');
$scope.name = "AngularJS";
$scope.next = function(){
window.open("#/second","_self");
};
alert('MainController end');
});
app.controller('secondController',function($scope){
alert('SecondController start');
$scope.name = "AngularJS 2";
$scope.back = function(){
window.open("#/","_self");
};
alert('SecondController end');
});
Here the name is {{name}}
<br />
<div ng-click="next()">
Click here
</div>
And here the name is {{name}}
<br />
<div ng-click="back()">
Go back
</div>