Skip to content

Instantly share code, notes, and snippets.

@amatiasq
Last active June 29, 2016 12:56
Show Gist options
  • Save amatiasq/a77e3cc16ade2365a1f695b18cded926 to your computer and use it in GitHub Desktop.
Save amatiasq/a77e3cc16ade2365a1f695b18cded926 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<title>My Angular App</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.js" data-main="index"></script>
</head>
<body>
<div ng-controller="MainController">
<my-directive></my-directive>
</div>
</body>
</html>
requirejs.config({ ... })
requirejs([ 'src/main' ], function() {
angular.bootstrap(document, [ 'myAppModule' ])
})
define(function(require) {
'use strict';
require('./my-directive')
var module = require('./my-module');
module.controller('MainController', function($scope) {
...
})
});
define(function(require) {
'use strict';
var module = require('./my-module');
module.directive('myDirective', function {
return { ... };
})
});
define(function(require) {
return angular.module('myAppModule', [])
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment