Skip to content

Commit c381989

Browse files
Merge remote-tracking branch 'upstream/master' into merge
# Conflicts: # app/js/on_config.js # package.json
2 parents 012a315 + 371a71f commit c381989

File tree

8 files changed

+20
-5
lines changed

8 files changed

+20
-5
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,16 @@ export default {
8282

8383
##### Dependency injection
8484

85-
Dependency injection is carried out with the `ng-annotate` library. The Gulp tasks will take care of injecting any dependencies, requiring you only to specify the dependencies within the function call and nothing more.
85+
Dependency injection is carried out with the `ng-annotate` library. In order to take advantage of this, a simple directive prologue of the format:
86+
87+
```js
88+
function MyService($http) {
89+
'ngInject';
90+
...
91+
}
92+
```
93+
94+
needs to be added at the very beginning of any Angular functions/modules. The Gulp tasks will then take care of adding any dependency injection, requiring you to only specify the dependencies within the function parameters and nothing more.
8695

8796
---
8897

app/js/filters/example.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
'use strict';
22

33
function ExampleFilter() {
4+
45
return function(input) {
56
return input.replace(/keyboard/ig,'leopard');
67
};
8+
79
}
810

911
export default {

app/js/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,6 @@ angular.module('app').config(require('./on_config'));
3232

3333
angular.module('app').run(require('./on_run'));
3434

35-
angular.bootstrap(document, ['app']);
35+
angular.bootstrap(document, ['app'], {
36+
strictDi: true
37+
});

app/js/on_config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
function OnConfig($stateProvider, $locationProvider, $urlRouterProvider, $compileProvider) {
4+
'ngInject';
45

56
/* This needs to remain disabled for bundled apps, as the base is disabled in the index.html */
67
$locationProvider.html5Mode(false);

app/js/on_run.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
function OnRun($rootScope, AppSettings) {
4+
'ngInject';
45

56
// change page title based on state
67
$rootScope.$on('$stateChangeSuccess', (event, toState) => {

app/js/services/example.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
function ExampleService($http) {
4+
'ngInject';
45

56
const service = {};
67

gulp/tasks/browserify.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ function buildScript(file) {
8080
.pipe(gulpif(createSourcemap, buffer()))
8181
.pipe(gulpif(createSourcemap, sourcemaps.init()))
8282
.pipe(gulpif(global.isProd, streamify(uglify({
83-
mangle: false,
8483
compress: { drop_console: true }
8584
}))))
8685
.pipe(gulpif(createSourcemap, sourcemaps.write('./')))

gulp/tasks/production.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import gulp from 'gulp';
44
import runSequence from 'run-sequence';
55

66
gulp.task('prod', ['clean'], function(cb) {
7-
7+
88
cb = cb || function() {};
99

1010
global.isProd = true;
1111

12-
runSequence(['styles', 'images', 'fonts', 'views', 'browserify'], 'gzip', cb);
12+
runSequence(['styles', 'images', 'fonts', 'views'], 'browserify', 'gzip', cb);
1313

1414
});

0 commit comments

Comments
 (0)