I am developing a one-page application using AngularJS and I am new to it. I asked the same question before, but I have no answer, so I will rephrase my question and ask it again.
QUESTION: I need to make my web application allow to work offline for this purpose, html files that appear as view (for example, home.html) should somehow be included in index.html, so when I click on some links should not need to have access to the html file, but part of the same page, for example, a dive will be displayed, what changes should I make in order to execute the project in order to do this.
at the moment I have created different html files and used them as templates for visualizing views, the structure of the application is as follows:
- index.html - pages ----- home.html ----- profile.html
here is the code for configuring routes and controllers and views
var formApp = angular.module('formApp', ['ngRoute']); formApp.config(function($routeProvider) { $routeProvider .when('/', { templateUrl : 'main', controller : 'mainController' }) .when('/profile', { templateUrl : 'profile', controller : 'profileController' }) });
And for example, my main.html file looks like this:
<div class="jumbotron text-center"> <h1>Main Page</h1> <p>{{ message }}</p> </div>
and somewhere in index.html I have
<div ng-view> {{ message }} </div>
The code is working correctly and everything is fine at the moment