0

我用角度编写了一些代码,但是当我更改页面时重新加载指令时出现问题。因此,当我从菜单进入页面时,我所有页面中包含的文件都不会重新加载。这是 app.js 文件中的一些代码:

 $stateProvider
  .state('dashboard', {
    url:'/dashboard',
    templateUrl: 'views/dashboard/main.html',
    resolve: {
        loadMyDirectives:function($ocLazyLoad){
            return $ocLazyLoad.load(
            {
                name:'sbAdminApp',
                files:[
                'scripts/directives/header/header.js',
                'scripts/directives/header/header-notification/header-notification.js',
                'scripts/directives/sidebar/sidebar.js',
                'scripts/directives/sidebar/sidebar-search/sidebar-search.js'
                ]
            })

以及来自页面控制器的一些代码:

"use strict";
  angular
    .module("sbAdminApp",['ngRoute'])
     .controller("ServicesCtrl",function($scope,getasap,NgTableParams,ngDialog){

    })
4

1 回答 1

0

如果您尝试在所有视图中使用标题,则不应将其放入延迟加载中。您的 index.html 应如下所示:

<body ng-app="app" ng-controller="AppCtrl as appCtrl">

<!-- Navigation -->
<div header></div>
<!-- /.navbar-top-links -->

<!-- Page Content -->
<div id="page-wrapper" ui-view></div>
<!-- /#page-wrapper -->


</body>
于 2015-12-17T16:43:48.330 回答