我用角度编写了一些代码,但是当我更改页面时重新加载指令时出现问题。因此,当我从菜单进入页面时,我所有页面中包含的文件都不会重新加载。这是 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){
})