Search code examples
angularangular-clivirtual-directory

How to add virtual directory to the default url of a project generated by angular-cli?


in a project generated by angular-cli, if you run:

ng serve -o

The browser will open a tab with this link by default:

http://localhost:4200

I want to add a virtual directory to this url, something like this:

http://localhost:4200/CompanyName/Product/Web

I know the --host and --port option can change the host and the port of this url, but I can't find an option to add the virtual directory.


Solution

  • You can use --base-href or -bh flag for that

    ng serve --base-href /CompanyName/Product/Web -o