Javascript not accessible from inside Angular ui-view

前端 未结 7 1562
执念已碎
执念已碎 2021-01-18 17:56

I have a main template (index.html) with an Angular ui-view. Inside this main template I import a bunch of Javascript files. I expect these files to be available to the cont

7条回答
  •  余生分开走
    2021-01-18 18:36

    Without seeing your project structure it's hard to know for sure, but I suspect that you need to refer to your javascript files using absolute paths rather than relative paths.

    EG:

    
    

    I say this because most AngularJS projects store their views in a sub-folder, and when the template gets loaded the relative paths become invalid because they are relative to the root of the project/index.html file and not the active view.

提交回复
热议问题