I want to build my angular project and generate a ZIP file containing it to send it via email and I want the person who receives it to be able to open it on his Desktop clicking index.html file.
I changed the baseUrl to ./ or to document.location but I'm getting the following error: "Unhandled Navigation Error"
Does anyone have any hint about how to fix this?
You can run angular app on double click on index.html file. Just add below code in your app.module.ts
note that : remove baseUrl = ./
from index.html file
//in App.module.ts :
//import these packages
import { APP_BASE_HREF, LocationStrategy, HashLocationStrategy } from '@angular/common';
// add these packages into providers as below :
@NgModule({
imports:
[
.....
],
declarations:
[
....
],
providers:
[
....
{ provide: APP_BASE_HREF, useValue: '/' },
{ provide: LocationStrategy, useClass: HashLocationStrategy },
....
]
....
})
export class Appmodule{}
Now execute : npm run build
and double click the index.html
file from dist
folder.
You app should run.