简体   繁体   中英

Angular: Relative js/css path

I'm new in angular, bower, grunt, etc stuff so I completely stuck with current issue. My project is built based on angular. In my index.html path to js/css like this

<script src="/scripts/shared/flow-item.js"></script>

after compiling with grunt path to js/css in index.html

<script src="scripts/app.da1aee60.js">

so that if i deploy project in ROOT on tomcat everything works perfect but if i deploy it in some folder like MyProject/ and call index.html we see application still looks for scripts by path http://localhost:8080/scripts/app.da1aee60.js instead http://localhost:8080/MyProject/scripts/app.da1aee60.js Is it possible in some say project look for script in proper path?

您可以在html中设置基本路径(在head标签内):

<base href="/scripts/MyProject/" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM