I have this html:
<div ng-controller="MyCtrl">
<div ng-view></div>
</div>
<script type="text/ng-template" id="/a">
// SomeHtml with Angular templates
</script>
<script type="text/ng-template" id="/b">
// SomeHtml with Angular templates
</script>
And:
angular.module('ngView', [], function($routeProvider, $locationProvider) {
$routeProvider.when('/a', {
templateUrl: '/a',
controller: MyCtrl
});
$routeProvider.when('/b', {
templateUrl: '/b',
controller: MyCtrl
});
});
The controller "MyCtrl" has some bootstrap code that is invoked when the html is first loaded, this bootstrap code sets up some state that should be used by both "/a" and "/b" template. Templates "/a" and "/b" will present the data obtained during the bootstrap to render in different ways.
I'd like to not have a controller and still be able to access MyCtrl scope from my templates.