简体   繁体   English

在angularjs SPA中重新加载时未加载脚本和样式表

[英]scripts and stylesheets not loading while reload in angularjs SPA

Index Page : 索引页:

  <ng-view></ng-view>

Angular Controller : 角度控制器:

    when('/', {
        url: '/',
        templateUrl: 'site/home',
        controller: 'indexController'
    }).

    when('/site/help', {
        templateUrl: 'site/help',
        controller: 'indexController'
    }).

Help Page Content : 帮助页面内容:

Some help Content 一些帮助内容

The Problem is when I navigate from Index page by using /site/help link it shows me help page content with menu of index page. 问题是当我使用/ site / help链接从索引页面导航时,它通过索引页面菜单向我显示帮助页面内容。

But when I reload the page it only shows help page content without any styles or javascripts loaded. 但是,当我重新加载页面时,它仅显示帮助页面内容,而未加载任何样式或javascript。

You should put ng-view tag in index.html, because this page is the main page and the other pages are part of that: 您应该将ng-view标记放在index.html中,因为此页面是主页,而其他页面是该页面的一部分:

<body> 
    //some content
    <ng-view></ng-view> 
</body>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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