仅供自己观看
//此处从上往下执行,(1)main.js只声明依赖,不执行配置,往下执行下面文件;(2)遇到依赖就注入,注满后执行配置;(3)从模块中找到与 <my-app></my-app>相关的定义(directive)和控制器(controllor)并渲染。
<!DOCTYPE html> <html lang="en" ng-controller="mainCtrl" ng-cloak> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <title ng-bind="r_g_company.info.title"></title> <link rel="shortcut icon" ng-href="{{r_g_company.info.favicon}}"> <link rel="stylesheet" href="../../static/common/bootstrap.css"> <link rel="stylesheet" href="../../static/common/sliderCaptcha/slidercaptcha.css"> </head> <body ondragstart="return false;"> <my-app></my-app> </body> <script src="../../static/common/jquery.js"></script> <script src="../../static/common/jquery-media.js"></script> <script src="../../static/common/sliderCaptcha/longbow.slidercaptcha.js"></script> <script src="../../static/common/angular.js"></script> <script src="../../static/common/angular-ui.js"></script> <!-- build:js(src) scripts/all.min.js --> <!-- inject:js --> //此处从上往下执行,(1)main.js只声明依赖,不执行配置,往下执行下面文件;(2)遇到依赖就注入,注满后执行配置;(3)从模块中找到与 <my-app></my-app>相关的定义(directive)和控制器(controllor)并渲染。 <script src="config/main.js"></script> <script src="config/ctrl.js"></script> <script src="config/project/cy/logo.js"></script> <script src="config/project/cy/menu.js"></script> <script src="config/project/cy/js/layer-skin.js"></script> <script src="module/common-serve/index/index.js"></script> <script src="module/common-directive/index/index.js"></script> <script src="config/project/cy/layout/index.js"></script> <script src="module/common-serve/account.js"></script> <script src="module/common-serve/change.js"></script> <script src="module/common-serve/cust-drag.js"></script> <script src="module/common-serve/data-g.js"></script> <script src="module/common-serve/date.js"></script> </html> //main.js (function () { angular .module('app', [ 'ui.router', 'angularTreeview', 'ng-layer', 'countUpModule', 'common-dir', 'common-serve', 'module-login', 'module-role', 'module-system', 'module-safe', 'module-interfaces', 'module-collect', 'module-audit', 'module-set', 'module-event', 'module-user', 'module-chart', 'module-record', 'module-policy', 'module-protocol', 'module-study' ]) .config(function ($stateProvider, $urlRouterProvider, menu) { angular.forEach(menu, function (item) { angular.forEach(item.subs, function (it) { $stateProvider .state(it.state, it.cfg); }); }); $urlRouterProvider.otherwise('/login'); }) .run(function ($rootScope, account_m, app_init, account_data) { app_init .size_init() .key_init() .account_init(); $rootScope.$on('$stateChangeStart', function (event, toState) { NProgress.start(); account_m.start(event, toState); } ); $rootScope.$on('$stateChangeSuccess', function (event, toState) { account_data.state = toState.name; NProgress.done(); } ); }); })(); //index.js (function () { angular .module('common-dir', []) .directive('myApp', function () { console.log('myApp'); var dirAlert = '<dir-alert></dir-alert>'; var dirCommon = '<dir-common style="height:100%"></dir-common>'; var dirTip = '<dir-tip></dir-tip>'; var dirLoading = '<dir-load></dir-load>'; var template = ''.concat(dirCommon, dirAlert, dirTip, dirLoading); return { restrict: 'E', template: template, scope: false, link: function () { } }; }); })();