Hey,
after quite some research I failed to find any good solution to my problem.
In Angular apps there seem to be the base index.html importing all the scripts and headers etc. This also contains declaration for ng-app which furthermore contains ng-view that's to be used with $routeProvider. My problem is that I would like to have two separate index.html -like html pages for different base views to be used with $routeProvider loading different scripts.
Let's imagine my web application consists of two main parts.
1. Front page: Header on top, some selections, footer.
Header and footer is to be included in every view so we will put them to index.html.
2. Chat screen. Completely different style and we want it without the header and footer that are now in the index.html.
index.html
<html>
<head> *Headers be here* </head>
<body ng-app="MainApp">
<!--header-->
<div ng-view></div>
<!--footer-->
<script> *Scripts be here* </script>
</body>
</html>
chatView.html
<html>
<head> *Headers be here* </head>
<body ng-app="Chat">
<div ng-view></div>
<script> *Scripts be here* </script>
</body>
</html>
app.js
angular.module('App', ['ngRoute','MainApp','Chat'])
.config(function ($routeProvider) {
$routeProvider...
});
});
angular.module('MainApp', ['ngRoute'])
.config(function ($routeProvider) {
$routeProvider...
//Routes to mainApp views.
});
});
angular.module('Chat', ['ngRoute'])
.config(function ($routeProvider) {
$routeProvider...
//Route to chat view.
});
});
So the main issue here is that I don't know how to split the ng-app into two different pages (ng-apps) I can use as the base template for rendering views.
I've been reading angular is mostly meant to be used in single page applications but I believe this should be doable without nasty hacks.
The code in my app.js example also doesn't work on my computer when I'm trying to run something similar. I'm not sure how to do the injections - and I read it might not be possible to define $routeParams in more than one module in the whole application.
And additionally, not to make it too easy, I need a working communication between the chat- and main-modules. The same authenticated login and session should be present in both, whereas also redirecting between these two will occur most times.