Skip to content

Instantly share code, notes, and snippets.

@JensRantil
Last active December 17, 2015 20:58
Show Gist options
  • Save JensRantil/5670869 to your computer and use it in GitHub Desktop.
Save JensRantil/5670869 to your computer and use it in GitHub Desktop.
Can't be tested locally due to same origin policies. I used Python's
SimpleHTTPServer for serving this:
$ python -m SimpleHTTPServer
Application 1's first template.
Application 1's second template.
Your name is {{name}}.
<html>
<head>
<title>Reproduce #2825</title>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"
type="text/javascript"></script>
<script
src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.0.6/angular.min.js"></script>
<script>
angular.module("app1", [])
.config(function($routeProvider) {
$routeProvider
.when('/page1', {
templateUrl:
'./app1-template1.html',
})
.when('/page2', {
templateUrl:
'./app1-template2.html',
})
.otherwise({redirectTo: '/page1'});
});
angular.module("app2", [])
.controller("Controller1", function($scope) {
$scope.name = "Arnold";
})
.controller("Controller2", function($scope) {
$scope.name = "Anna";
});
jQuery(function() {
angular.bootstrap(jQuery('#app1').get(),
['app1']);
angular.bootstrap(jQuery('#app2').get(),
['app2']);
});
</script>
</head>
<body>
<div id="app1">
<a href="#/page1">Page1</a>
<a href="#/page2">Page2</a>
<div ng-view></div>
</div>
<div id="app2">
<div data-ng-controller="Controller1" data-ng-include
src="'app2-template1.html'"></div>
<div data-ng-controller="Controller2" data-ng-include
src="'app2-template1.html'"></div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment