Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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