Skip to content

Commit 71f1dd3

Browse files
author
natee
committed
update
2 parents 0b6ae08 + 257775f commit 71f1dd3

35 files changed

+3106
-1575
lines changed

README.md

Lines changed: 214 additions & 78 deletions
Large diffs are not rendered by default.

assets/brackets-angular-snippets.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,6 @@
102102
103103
/* @ngInject */
104104
function ${2: directive}(${3:dependencies}) {
105-
// Usage:
106-
//
107-
// Creates:
108-
//
109105
var directive = {
110106
bindToController: true,
111107
controller: ${4:Controller},
@@ -171,9 +167,9 @@
171167
scope: javascript
172168
text: |
173169
.state('${1:state}', {
174-
url: '${2:/url}'
170+
url: '${2:/url}',
175171
templateUrl: '${3:template}.html',
176-
controller: '${4:Controller}'
172+
controller: '${4:Controller}',
177173
controllerAs: '${5:vm}'
178174
})${6:}
179175

assets/gde.png

60.5 KB
Loading

assets/sublime-angular-snippets/angular.directive.sublime-snippet

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
${2:directive}.\$inject = [${3/(\$(\w+)|\w+)/'$1'/g}];
1010
1111
/* @ngInject */
12-
function ${2:directive} (${3:dependencies}) {
12+
function ${2:directive}(${3:dependencies}) {
1313
// Usage:
1414
//
1515
// Creates:
@@ -30,7 +30,7 @@
3030
}
3131
3232
/* @ngInject */
33-
function ${4:Controller} () {
33+
function ${4:Controller}() {
3434
3535
}
3636
})();
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
snippet ngcontroller
2+
(function() {
3+
'use strict';
4+
5+
angular
6+
.module('${1:module}')
7+
.controller('${2:Controller}Controller', $2Controller);
8+
9+
/* @ngInject */
10+
function $2Controller(${3:dependencies}) {
11+
var vm = this;
12+
vm.title = '$2Controller';
13+
14+
activate();
15+
16+
////////////////
17+
18+
function activate() {
19+
}
20+
}
21+
})();
22+
endsnippet
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
snippet ngdirective
2+
(function() {
3+
'use strict';
4+
5+
angular
6+
.module('${1:module}')
7+
.directive('${2:directive}', $2);
8+
9+
/* @ngInject */
10+
function $2(${3:dependencies}) {
11+
// Usage:
12+
//
13+
// Creates:
14+
//
15+
var directive = {
16+
bindToController: true,
17+
controller: ${4:Controller},
18+
controllerAs: '${5:vm}',
19+
link: link,
20+
restrict: 'A',
21+
scope: {
22+
}
23+
};
24+
return directive;
25+
26+
function link(scope, element, attrs) {
27+
}
28+
}
29+
30+
/* @ngInject */
31+
function $4() {
32+
33+
}
34+
})();
35+
endsnippet
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
snippet ngfactory
2+
(function() {
3+
'use strict';
4+
5+
angular
6+
.module('${1:module}')
7+
.factory('${2:factory}', $2);
8+
9+
/* @ngInject */
10+
function $2(${3:dependencies}) {
11+
var service = {
12+
${4:func}: $4
13+
};
14+
return service;
15+
16+
////////////////
17+
18+
function $4() {
19+
}
20+
}
21+
})();
22+
endsnippet
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
snippet ngfilter
2+
(function() {
3+
'use strict';
4+
5+
angular
6+
.module('${1:module}')
7+
.filter('${2:filter}', $2);
8+
9+
function $2() {
10+
return $2Filter;
11+
12+
////////////////
13+
function $2Filter(${3:params}) {
14+
return $3;
15+
};
16+
}
17+
18+
})();
19+
endsnippet
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
snippet ngmodule
2+
(function() {
3+
'use strict';
4+
5+
angular
6+
.module('${1:module}', [
7+
'${2:dependencies}'
8+
]);
9+
})();
10+
endsnippet
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
snippet ngservice
2+
(function() {
3+
'use strict';
4+
5+
angular
6+
.module('${1:module}')
7+
.service('${2:Service}', $2);
8+
9+
/* @ngInject */
10+
function $2(${3:dependencies}) {
11+
this.${4:func} = $4;
12+
13+
////////////////
14+
15+
function $4() {
16+
}
17+
}
18+
})();
19+
endsnippet
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
{
2+
"Angular Controller": {
3+
"prefix": "ngcontroller",
4+
"body": [
5+
"(function() {",
6+
"'use strict';",
7+
"",
8+
"\tangular",
9+
"\t\t.module('${Module}')",
10+
"\t\t.controller('${Controller}Controller', ${Controller}Controller);",
11+
"",
12+
"\t${Controller}Controller.$inject = ['${dependency1}'];",
13+
"\tfunction ${Controller}Controller(${dependency1}) {",
14+
"\t\tvar vm = this;",
15+
"\t\t$0",
16+
"",
17+
"\t\tactivate();",
18+
"",
19+
"\t\t////////////////",
20+
"",
21+
"\t\tfunction activate() { }",
22+
"\t}",
23+
"})();"
24+
],
25+
"description": "Angular 1 controller"
26+
},
27+
"Angular Service": {
28+
"prefix": "ngservice",
29+
"body": [
30+
"(function() {",
31+
"'use strict';",
32+
"",
33+
"\tangular",
34+
"\t\t.module('${Module}')",
35+
"\t\t.service('${Service}', ${Service});",
36+
"",
37+
"\t${Service}.$inject = ['${dependency1}'];",
38+
"\tfunction ${Service}(${dependency1}) {",
39+
"\t\tthis.${exposedFn} = ${exposedFn};",
40+
"\t\t$0",
41+
"\t\t////////////////",
42+
"\t\tfunction ${exposedFn}() { }",
43+
"\t}",
44+
"})();"
45+
],
46+
"description": "Angular 1 service"
47+
},
48+
"Angular Factory": {
49+
"prefix": "ngfactory",
50+
"body": [
51+
"(function() {",
52+
"'use strict';",
53+
"",
54+
"\tangular",
55+
"\t\t.module('${Module}')",
56+
"\t\t.factory('${Service}', ${Service});",
57+
"",
58+
"\t${Service}.$inject = ['${dependency1}'];",
59+
"\tfunction ${Service}(${dependency1}) {",
60+
"\t\tvar service = {",
61+
"\t\t\t${exposedFn}:${exposedFn}",
62+
"\t\t};",
63+
"\t\t$0",
64+
"\t\treturn service;",
65+
"",
66+
"\t\t////////////////",
67+
"\t\tfunction ${exposedFn}() { }",
68+
"\t}",
69+
"})();"
70+
],
71+
"description": "Angular 1 factory"
72+
},
73+
"Angular Directive": {
74+
"prefix": "ngdirective",
75+
"body": [
76+
"(function() {",
77+
"\t'use strict';",
78+
"",
79+
"\tangular",
80+
"\t\t.module('${Module}')",
81+
"\t\t.directive('${Directive}', ${Directive});",
82+
"",
83+
"\t${Directive}.$inject = ['${dependency1}'];",
84+
"\tfunction ${Directive}(${dependency1}) {",
85+
"\t\t// Usage:",
86+
"\t\t//",
87+
"\t\t// Creates:",
88+
"\t\t//",
89+
"\t\tvar directive = {",
90+
"\t\t bindToController: true,",
91+
"\t\t controller: ${Controller}Controller,",
92+
"\t\t controllerAs: '${vm}',",
93+
"\t\t link: link,",
94+
"\t\t restrict: 'A',",
95+
"\t\t scope: {",
96+
"\t\t }",
97+
"\t\t};",
98+
"\t\treturn directive;",
99+
"\t\t",
100+
"\t\tfunction link(scope, element, attrs) {",
101+
"\t\t}",
102+
"\t}",
103+
"\t/* @ngInject */",
104+
"\tfunction ${Controller}Controller () {",
105+
"\t\t$0",
106+
"\t}",
107+
"})();"
108+
],
109+
"description": "Angular 1 directive"
110+
},
111+
"Angular Module": {
112+
"prefix": "ngmodule",
113+
"body": [
114+
"(function() {",
115+
"\t'use strict';",
116+
"",
117+
"\tangular.module('${module}', [",
118+
"\t\t$0",
119+
"\t]);",
120+
"})();"
121+
],
122+
"description": "Angular 1 module"
123+
}
124+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"Angular Controller": {
3+
"prefix": "ngcontroller",
4+
"body": [
5+
"namespace ${module} {",
6+
"'use strict';",
7+
"",
8+
"export class ${Controller}Controller {",
9+
"\tstatic $inject: Array<string> = ['${dependency1}'];",
10+
"\tconstructor(private ${dependency1}: ${dependency1Type}) {",
11+
"$0",
12+
"}",
13+
"",
14+
"\t${property}: ${propertyType} = ${propertyValue};",
15+
"",
16+
"\t${fn}() { }",
17+
"}",
18+
"",
19+
"angular",
20+
"\t.module('${Module}')",
21+
"\t.controller('${Controller}Controller', ${Controller}Controller);",
22+
"}"
23+
]
24+
},
25+
"Angular Service": {
26+
"prefix": "ngservice",
27+
"body": [
28+
"namespace ${module} {",
29+
"'use strict';",
30+
"",
31+
"export interface I${Service} {",
32+
"\t${serviceFn}: (${dependency1}:${dependency1Type}) => ${returnType};",
33+
"}",
34+
"export class ${Service} implements I${Service} {",
35+
"\tstatic $inject: Array<string> = ['${dependency1}'];",
36+
"\tconstructor(private ${dependency1}: ${dependency1Type}) {",
37+
"",
38+
"}",
39+
"",
40+
"\t${serviceFn}: (${dependency1}:${dependency1Type}) => ${returnType} = (${dependency1}:${dependency1Type}) => {",
41+
"\t\t$0",
42+
"\t}",
43+
"",
44+
"}",
45+
"",
46+
"angular",
47+
"\t.module('${Module}')",
48+
"\t.service('${Service}', ${Service});",
49+
"}"
50+
]
51+
},
52+
"Angular Module": {
53+
"prefix": "ngmodule",
54+
"body": [
55+
"namespace ${module} {",
56+
"\t'use strict';",
57+
"",
58+
"\tangular.module('${module}', [",
59+
"\t$0",
60+
"\t]);",
61+
"}"
62+
]
63+
}
64+
}
Binary file not shown.

0 commit comments

Comments
 (0)