Skip to content

Instantly share code, notes, and snippets.

@stryju
Last active August 29, 2015 14:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stryju/ad0461ceb2f309d1e641 to your computer and use it in GitHub Desktop.
Save stryju/ad0461ceb2f309d1e641 to your computer and use it in GitHub Desktop.
require angular sublime snippets
<snippet>
<content><![CDATA[
/* global define */
define( function ( require, exports, module ) {
'use strict';
$1
});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>def</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
<snippet>
<content><![CDATA[
/* global define */
define( function ( require, exports, module ) {
'use strict';
// @ngInject
function ${1:controller}( ${2:\$scope} ) {
// jshint validthis:true
// jshint latedef:false
var ctrl = this;
$3
// ---
}
module.exports = $1;
});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>ngc</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
<snippet>
<content><![CDATA[
/* global define */
define( function ( require, exports, module ) {
'use strict';
// @ngInject
function directive( $4 ) {
return {
// restrict : 'E',
template : require( 'text!./template.html' ),
// transclude : true,
// $2controller : require( './controller' ),
// $2controllerAs : '$1Ctrl',
scope : ${3:{\}},
// link : function ( scope, element, attrs ) {},
};
}
module.exports = directive;
});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>ngd</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
<snippet>
<content><![CDATA[
/* global define */
define( function ( require, exports, module ) {
'use strict';
var deps = [
$2
];
module.exports = require( 'angular' ).module( '$1', deps )
// $3.config( require( './config' ) )
$4
;
});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>ngm</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
<snippet>
<content><![CDATA[
/* global define */
define( function ( require, exports, module ) {
'use strict';
var state = {
// abstract : false,
url : '/$1',
template : require( 'text!./template.html' ),
controller : require( './controller' ),
controllerAs : '$2Ctrl',
// data : {
// },
// meta : {
// icon : '',
// label : '',
// menu : true
// },
// resolve : {
// },
}
module.exports = state;
});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>ngs</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
<snippet>
<content><![CDATA[
/* global require */
require( function ( require, exports, module ) {
'use strict';
$1
});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>req</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment