Skip to content

Instantly share code, notes, and snippets.

@eddiemonge
Created August 5, 2014 01:16
Show Gist options
  • Save eddiemonge/edf2f91f63672f0c7bee to your computer and use it in GitHub Desktop.
Save eddiemonge/edf2f91f63672f0c7bee to your computer and use it in GitHub Desktop.
Angular Module style 1
'use strict';
angular.module('myApp', ['widget']);
(function (angular) {
var widgetModule;
try {
widgetModule = angular.module('widget');
}
catch (e) {
widgetModule = angular.module('widget', []);
}
widgetModule
.directive('bye', function () {
return {
template: '<div></div>',
restrict: 'E',
link: function postLink(scope, element) {
element.text('this is the bye directive');
}
};
});
}(window.angular));
(function (angular) {
var widgetModule;
try {
widgetModule = angular.module('widget');
}
catch (e) {
widgetModule = angular.module('widget', []);
}
widgetModule
.directive('hello', function () {
return {
template: '<div></div>',
restrict: 'E',
link: function postLink(scope, element) {
element.text('this is the hello directive');
}
};
});
}(window.angular));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment