Skip to content

Commit 796d259

Browse files
authored
Getting the latest (#2)
* fix typo: declaration => declarations * Original text and redundant removed * Fixed typo * fix: wrong URL (#763) thanks! * Fixed typo (#762) thanks! * Fix link to sublime snippets, add new commands (#761) thanks! * Replace "AngulRJS" to "AngularJS" (#757) thanks! * update angular 1 karma test runner code snippet to following updated karma api (#756) thanks! * Update ru-RU.md (#734) * add Emacs snippets (#684) thanks! * Update screenshot to include 'Controller' suffix (#776)
1 parent d2c6568 commit 796d259

File tree

15 files changed

+207
-30
lines changed

15 files changed

+207
-30
lines changed

a1/README.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2553,7 +2553,7 @@ Unit testing helps maintain clean code, as such I included some of my recommenda
25532553
var child;
25542554
var excludeFiles = [];
25552555
var fork = require('child_process').fork;
2556-
var karma = require('karma').server;
2556+
var Server = require('karma').Server;
25572557
var serverSpecs = config.serverIntegrationSpecs;
25582558

25592559
if (args.startServers) {
@@ -2568,11 +2568,14 @@ Unit testing helps maintain clean code, as such I included some of my recommenda
25682568
}
25692569
}
25702570

2571-
karma.start({
2572-
configFile: __dirname + '/karma.conf.js',
2573-
exclude: excludeFiles,
2574-
singleRun: !!singleRun
2575-
}, karmaCompleted);
2571+
var karmaOptions = {
2572+
configFile: __dirname + '/karma.conf.js',
2573+
exclude: excludeFiles,
2574+
singleRun: !!singleRun
2575+
};
2576+
2577+
let server = new Server(karmaOptions, karmaCompleted);
2578+
server.start();
25762579

25772580
////////////////
25782581

@@ -3123,6 +3126,27 @@ Use file templates or snippets to help follow consistent styles and patterns. He
31233126
ngservice // creates an Angular service
31243127
```
31253128
3129+
### Emacs
3130+
###### [Style [Y257](#style-y257)]
3131+
3132+
- [Emacs](https://www.gnu.org/software/emacs/) snippets that follow these styles and guidelines.
3133+
3134+
- Download the [Emacs Angular snippets](assets/emacs-angular-snippets?raw=true)
3135+
3136+
Note that yasnippet categorizes snippets by major mode, and there are several Emacs major modes for editing Javascript code. The snippets are in `js2-mode`, and the other directories contain only a dotfile to reference them there.
3137+
3138+
- install [yasnippet](https://github.com/capitaomorte/yasnippet) (`M-x package-install RET yasnippet RET`)
3139+
- copy snippets to snippet directory, or modify your Emacs init to add snippet directory to `yas-snippet-dirs`
3140+
3141+
```javascript
3142+
ngcontroller // creates an Angular controller
3143+
ngdirective // creates an Angular directive
3144+
ngfactory // creates an Angular factory
3145+
ngmodule // creates an Angular module
3146+
ngservice // creates an Angular service
3147+
ngfilter // creates an Angular filter
3148+
```
3149+
31263150
**[Back to top](#table-of-contents)**
31273151
31283152
## Yeoman Generator

a1/assets/above-the-fold-1.png

-42.5 KB
Loading
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
js2-mode
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
js2-mode
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- mode: snippet; require-final-newline: nil -*-
2+
# name: ngcontroller
3+
# key: ngcontroller
4+
# binding: direct-keybinding
5+
# --
6+
7+
(function() {
8+
'use strict';
9+
10+
angular
11+
.module('${1:module}')
12+
.controller('${2:Controller}Controller', $2Controller);
13+
14+
/* @ngInject */
15+
function $2Controller(${3:dependencies}) {
16+
var vm = this;
17+
vm.title = '$2Controller';
18+
19+
activate();
20+
21+
////////////////
22+
23+
function activate() {
24+
}
25+
}
26+
})();
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# -*- mode: snippet; require-final-newline: nil -*-
2+
# name: ngdirective
3+
# key: ngdirective
4+
# binding: direct-keybinding
5+
# --
6+
7+
(function() {
8+
'use strict';
9+
10+
angular
11+
.module('${1:module}')
12+
.directive('${2:directive}', $2);
13+
14+
/* @ngInject */
15+
function $2(${3:dependencies}) {
16+
// Usage:
17+
//
18+
// Creates:
19+
//
20+
var directive = {
21+
bindToController: true,
22+
controller: ${4:Controller},
23+
controllerAs: '${5:vm}',
24+
link: link,
25+
restrict: 'A',
26+
scope: {
27+
}
28+
};
29+
return directive;
30+
31+
function link(scope, element, attrs) {
32+
}
33+
}
34+
35+
/* @ngInject */
36+
function $4() {
37+
38+
}
39+
})();
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- mode: snippet; require-final-newline: nil -*-
2+
# name: ngfactory
3+
# key: ngfactory
4+
# binding: direct-keybinding
5+
# --
6+
7+
(function() {
8+
'use strict';
9+
10+
angular
11+
.module('${1:module}')
12+
.factory('${2:factory}', $2);
13+
14+
/* @ngInject */
15+
function $2(${3:dependencies}) {
16+
var service = {
17+
${4:func}: $4
18+
};
19+
return service;
20+
21+
////////////////
22+
23+
function $4() {
24+
}
25+
}
26+
})();
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- mode: snippet; require-final-newline: nil -*-
2+
# name: ngfilter
3+
# key: ngfilter
4+
# binding: direct-keybinding
5+
# --
6+
7+
(function() {
8+
'use strict';
9+
10+
angular
11+
.module('${1:module}')
12+
.filter('${2:filter}', $2);
13+
14+
function $2() {
15+
return $2Filter;
16+
17+
////////////////
18+
function $2Filter(${3:params}) {
19+
return $3;
20+
};
21+
}
22+
23+
})();
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# -*- mode: snippet; require-final-newline: nil -*-
2+
# name: ngmodule
3+
# key: ngmodule
4+
# binding: direct-keybinding
5+
# --
6+
7+
(function() {
8+
'use strict';
9+
10+
angular
11+
.module('${1:module}', [
12+
'${2:dependencies}'
13+
]);
14+
})();
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- mode: snippet; require-final-newline: nil -*-
2+
# name: ngservice
3+
# key: ngservice
4+
# binding: direct-keybinding
5+
# --
6+
7+
(function() {
8+
'use strict';
9+
10+
angular
11+
.module('${1:module}')
12+
.service('${2:Service}', $2);
13+
14+
/* @ngInject */
15+
function $2(${3:dependencies}) {
16+
this.${4:func} = $4;
17+
18+
////////////////
19+
20+
function $4() {
21+
}
22+
}
23+
})();

0 commit comments

Comments
 (0)