P
P
Peter2015-11-03 14:02:41
Angular
Peter, 2015-11-03 14:02:41

How to build angular with routes for different directories?

The project is made on Angular.js using routing without # . For the routing to work correctly, the header must contain , where dir is the root directory.
But on our server, versions are uploaded automatically and look like this: site.ru/vers_1.9. those. on site.ru list with links to versions, and in site.ru/vers_x.x. the same interface. Accordingly, /vers_x.x./ should be written in the base tag /vers_x.x./
Each time it is not an option to manually register. It is problematic to automatically write the same in index.html. The best option is the configuration file, where jenkins set the path when uploading to the server.
I tried to implement:
1. download config.json from the beginning
2. parse it
3. from the received data we substitute into the markup
4. and at the end of the body we substitute all the remaining scripts.
But there are a lot of errors in the console and the project does not start.
An example can be viewed here .

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yaroslav Lyzlov, 2015-11-03
@dixoNich

Write a simple gulp-task
https://www.npmjs.com/package/gulp-inject

_
_ _, 2015-11-03
@AMar4enko

Mark solutions in your questions, respect the work of the community.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question