Created
December 14, 2015 01:14
-
-
Save scarfunk/96312a581f702459a118 to your computer and use it in GitHub Desktop.
question! 도움!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//app.js | |
import angular from 'angular'; | |
//1) sub 모듈 생성(모듈에서 라우터 사용). 하지만 ui.router 모듈이 없으므로 fail | |
angular.module('app.sub', ['ui.router']); | |
//2) 모듈생성만 하고, sub.js 에서 인젝션한다면. | |
import from 'sub.js'; // 생성보다 import 가 먼저라서 실패하게 됨. | |
angular.module('app.sub', []); | |
//3) 그럼 결국은 sub.js 에서 모듈을 생성+설정+로직등을 전부 하고 | |
//전역에서 불러와서. app 모듈에 삽입후 부트스트랩 해아하나요? | |
//그럼 서브 모듈에 | |
//import 'veryheavymodule' | |
//angular.module('app.sub', [veryheavymodule]); | |
//은 app.js 부트스트랩 과정에서 전부 불러오니 최초 페이지 로딩 시간이 길어질수 밖에 없나요? | |
import from 'sub.js'; | |
angular.module('app', ['app.sub']) | |
.controller('appController', function(){ | |
console.log('main loaded!'); | |
}) | |
//부트스트랩 | |
angular.element(document).ready(function () { | |
angular.bootstrap(document, ['app'], { | |
//strictDi: true | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'angular-ui-router'; //ui router | |
//불러와서 재사용. | |
angular.module('app.sub') | |
.config(subConfig) | |
.controller('subController', function(){ | |
console.log('subController loaded!'); | |
}) | |
function subConfig($stateProvider){ | |
$stateProvider | |
.state('sub', { | |
url: '/sub', | |
controller: 'subController', | |
templateUrl: 'sub.html' | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
어떤건 1탭이고 어떤건 4스페이스인데 하나로 통일해주시면 아름다울것 같아요!!! 기왕 하시는거 2스페이스로…? 갑툭튀 죄송합니다. ㅠㅠ;