Last active
October 12, 2015 20:58
-
-
Save orlandohohmeier/4086254 to your computer and use it in GitHub Desktop.
Angular (AMD) Intellij Templates
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
// | |
//Angular Bootstrap (AMD) Intellij Template | |
// | |
/** | |
* ${Name} | |
* | |
* @author ${USER} | |
*/ | |
//Config | |
requirejs.config({ | |
paths:{ | |
angular :'path/to/angular' | |
}, | |
shim :{ | |
angular:{ | |
deps :[''], | |
exports:'angular' | |
} | |
} | |
}); | |
//Bootstrap | |
require(['angular', 'context-name'], function (angular, Context) { | |
//Create new Context | |
var context = new Context(); | |
//Bootstrap App | |
angular.bootstrap(document, [Context.ID]); | |
}); |
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
// | |
//Angular Context (AMD) Intellij Template | |
// | |
define(function (require) { | |
"use strict"; | |
//#import | |
var angular = require('angular'); | |
var ServiceName = require('services/servicename'); | |
var directiveName = require('directives/directivename'); | |
var ControllerName = require('controller/controllername'); | |
var ModelName = require('model/modelname'); | |
//@implementation | |
/** | |
* ${Name} | |
* | |
* @author ${USER} | |
* | |
* @constructor | |
*/ | |
function ${Name}() { | |
//Create Context | |
var instance = angular.module(${Name}.ID, []); | |
/** | |
* Init | |
*/ | |
function init() { | |
//Map Model | |
instance.value('modelName', new ModelName()); | |
instance.factory('ModelName', ModelName); | |
//Map Services | |
instance.factory('ServiceName', ServiceName); | |
//Map Directives | |
instance.directive('directiveName', directiveName); | |
//Map Controller | |
instance.controller('ControllerName', ControllerName); | |
} | |
//Call Init | |
init(); | |
return instance; | |
} | |
//ID | |
${Name}.ID = '${Name}'; | |
return ${Name}; | |
//@end | |
}); |
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
// | |
//Angular Controller (AMD) Intellij Template | |
// | |
define(function (require) { | |
"use strict"; | |
//#import | |
//@implementation | |
/** | |
* ${Name} | |
* | |
* @author ${USER} | |
* | |
* @constructor | |
*/ | |
function ${Name}(scope) { | |
/** | |
* Init | |
*/ | |
function init() { | |
} | |
//Call Init | |
init(); | |
} | |
//Inject | |
${Name}.\$inject = ['\$scope']; | |
//Export | |
return ${Name}; | |
//@end | |
}); |
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
// | |
//Angular Directive (AMD) Intellij Template | |
// | |
define(function (require) { | |
"use strict"; | |
//#import | |
//@implementation | |
/** | |
* ${Name} | |
* | |
* @author ${USER} | |
* | |
* @see http://docs.angularjs.org/guide/directive | |
* | |
* @factory | |
*/ | |
function ${Name}(injectables) { | |
//Instance | |
var instance = {}; | |
//Name of the current scope. Optional defaults to the name at registration. | |
instance.name = ''; | |
//The priority is used to sort the directives before their compile functions get called. Higher priority goes first. | |
instance.priority = 0; | |
//If set to true then the current priority will be the last set of directives which will execute | |
//(any directives at the current priority will still execute as the order of execution on same priority is undefined). | |
instance.terminal = false; | |
//Directive Scope | |
instance.scope = false; | |
//Controller constructor function. | |
instance.controller = null; | |
// Require another controller be passed into current directive linking function. | |
instance.require = null; | |
//String of subset of EACM which restricts the directive to a specific directive declaration style. | |
instance.restrict = 'A'; | |
//Replace the current element with the contents of the HTML. | |
instance.template = ''; | |
//Same as template but the template is loaded from the specified URL. | |
instance.templateUrl = '' | |
//If set to true then the template will replace the current element, rather than append the template to the element. | |
instance.replace = false | |
//Compile the content of the element and make it available to the directive. Typically used with ngTransclude. | |
instance.transclude = false | |
//Compile function deals with transforming the template DOM. | |
instance.compile = function compile(element, attrs, transclude) { | |
//A compile function can have a return value which can be either a function or an object. | |
//returning a function - is equivalent to registering the linking function via the link property of the | |
//config object when the compile function is empty. | |
return function link(scope, element, attrs, controller) {}; | |
//returning an object with function(s) registered via pre and post properties - allows you to control | |
//when a linking function should be called during the linking phase. See info about pre-linking and | |
//post-linking functions below. | |
return { | |
pre: function preLink(scope, element, attrs, controller) {}, | |
post: function postLink(scope, element, attrs, controller) {} | |
} | |
} | |
//link function is responsible for registering DOM listeners as well as updating the DOM. | |
//It is executed after the template has been cloned. This is where most of the directive logic will be put. | |
instance.link = function postLink(scope, element, attrs) {}; | |
return instance; | |
} | |
//Inject | |
${Name}.\$inject = ['']; | |
//Export | |
return ${Name}; | |
//@end | |
}); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
//Require Config | |
var require = { | |
waitSeconds: 0, | |
urlArgs: 'v={{version}}', | |
baseUrl: "path/to/", | |
deps : ['bootstrap'] | |
}; | |
</script> | |
<script src="path/to/require.js?v={{version}}" type="text/javascript"></script> | |
</body> | |
</html> |
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
// | |
//Angular Service (AMD) Intellij Template | |
// | |
define(function (require) { | |
"use strict"; | |
//#import | |
//@implementation | |
/** | |
* ${Name} | |
* | |
* @author ${USER} | |
* | |
* @factory | |
*/ | |
function ${Name}(http) { | |
//Instance | |
var instance = {}; | |
/** | |
* Init | |
*/ | |
function init() { | |
} | |
//Call Init | |
init(); | |
return instance; | |
} | |
//Inject | |
${Name}.\$inject = ['\$http']; | |
//Export | |
return ${Name}; | |
//@end | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment