Skip to content

Instantly share code, notes, and snippets.

@chinghanho
Created September 1, 2013 06:10
Show Gist options
  • Save chinghanho/6402637 to your computer and use it in GitHub Desktop.
Save chinghanho/6402637 to your computer and use it in GitHub Desktop.
window.app = angular.module('myApp', []);
function ArticlesController($scope) {
$scope.articles = {}
}
window.app.config(function($routeProvider) {
$routeProvider
.when('', {})
.otherwise('', {});
})
<script src="jquery.min.js"></script>
<script src="angular.min.js"></script>
<script src="app.js"></script>
<script src="config"></script>
<script src="controllers/articles"></script>
<script src="init.js"></script>
window.bootstrap = function() {
angular.bootstrap(document, ['myApp']);
}
window.init = function() {
window.bootstrap();
}
$(document).ready(function() {
window.init();
});
@chinghanho
Copy link
Author

Another way to organize controllers:

controllers = {};
controllers.ArticleCtrl = function($scope) {[]};

window.app.controller(controllers);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment