Skip to content
This repository was archived by the owner on Aug 29, 2021. It is now read-only.

Commit 5ec31f9

Browse files
committed
Fixed minification/injector issue.
Manually added $inject (which should be added by @ngInject, but sadly ng-annotate didn't work). Now run the examples in ng-strict-di mode to prevent minification issues in the future. Removed "use strict" statements, which is added by traceur via gulp-noprotocol
1 parent 79b53b0 commit 5ec31f9

File tree

12 files changed

+40
-38
lines changed

12 files changed

+40
-38
lines changed

gulpfile.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,20 @@ var livereload = require('gulp-livereload');
77
* Create the angular-keyboard.js and angular-keyboard.min.js files.
88
*/
99
gulp.task('build', function () {
10-
return gulp
10+
gulp
1111
.src(['src/keyboard.module.js', 'src/**/*.js']) // All *.js files, but keyboard.module.js first.
1212
.pipe(noprotocol.angular({
13-
output: 'keyboard.js'
14-
})).pipe(gulp.dest('bower-angular-keyboard/'));
13+
bundle: 'keyboard.min.js'
14+
}))
15+
.pipe(gulp.dest('bower-angular-keyboard/'));
16+
17+
gulp
18+
.src(['src/keyboard.module.js', 'src/**/*.js'])
19+
.pipe(noprotocol.angular({
20+
bundle: 'keyboard.js',
21+
minify: false
22+
}))
23+
.pipe(gulp.dest('bower-angular-keyboard/'));
1524
});
1625
/**
1726
* Watch for file-changes, start a livereload server and rebuild on every change.

minisite/public/example-focus.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html ng-app="demo">
2+
<html ng-app="demo" ng-strict-di>
33
<head>
44
<title>kbFocus demo - Angular Keyboard</title>
55
<meta name="viewport" content="width=device-width, initial-scale=1">
@@ -49,11 +49,11 @@ <h1>Angular Keyboard: kbFocus</h1>
4949
<script src="js/angular-keyboard/keyboard.js"></script>
5050
<script>
5151
var demo = angular.module('demo', ['keyboard']);
52-
demo.run(function ($rootScope, kbFocus) {
52+
demo.run(['$rootScope', 'kbFocus', function ($rootScope, kbFocus) {
5353
$rootScope.kbFocus = kbFocus;
5454

5555
$rootScope.autofocus = (Math.random() > 0.5) ? 'email' : 'password';
56-
});
56+
}]);
5757
</script>
5858
</body>
5959
</html>

minisite/public/example-menu.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
77
<link rel="stylesheet" href="http://bootswatch.com/sandstone/bootstrap.css">
88
</head>
9-
<body ng-app="demo">
9+
<body ng-app="demo" ng-strict-di>
1010
<div class="container">
1111
<h1>Angular Keyboard: kb-invoke</h1>
1212
<div class="row">
@@ -54,7 +54,7 @@ <h2>Log</h2>
5454
<script src="js/angular-keyboard/keyboard.js"></script>
5555
<script>
5656
var demo = angular.module('demo', ['keyboard']);
57-
demo.run(function ($rootScope, kbFocus) {
57+
demo.run(['$rootScope', 'kbFocus', function ($rootScope, kbFocus) {
5858
$rootScope.messages = [];
5959
$rootScope.menu = {};
6060
$rootScope.toggleMenu = function () {
@@ -73,7 +73,7 @@ <h2>Log</h2>
7373
});
7474
};
7575
// $rootScope.toggleMenu();
76-
});
76+
}]);
7777
</script>
7878
</body>
7979
</html>

minisite/public/example-modes.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html ng-app="demo">
2+
<html ng-app="demo" ng-strict-di>
33
<head>
44
<title>kb-list demo - Angular Keyboard</title>
55
<meta name="viewport" content="width=device-width, initial-scale=1">
@@ -90,7 +90,7 @@ <h1>Angular Keyboard: kbList modes</h1>
9090
<script src="js/angular-keyboard/keyboard.js"></script>
9191
<script>
9292
var demo = angular.module('demo', ['keyboard']);
93-
demo.run(function ($rootScope, $timeout, $interval, $log) {
93+
demo.run(['$rootScope', '$timeout', '$interval', '$log', function ($rootScope, $timeout, $interval, $log) {
9494
$rootScope.$log = $log;
9595
var items = [];
9696
for (var i = 0; i < 15; i++) {
@@ -111,7 +111,7 @@ <h1>Angular Keyboard: kbList modes</h1>
111111
// $interval(function () {
112112
// $rootScope.items[10].name = Faker.Name.findName(); // Test model binding
113113
// }, 3000);
114-
});
114+
}]);
115115
</script>
116116
</body>
117117
</html>

minisite/public/example-orientation.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html ng-app="demo">
2+
<html ng-app="demo" ng-strict-di>
33
<head>
44
<title>Scroll and orientation - Angular Keyboard</title>
55
<meta name="viewport" content="width=device-width, initial-scale=1">
@@ -88,13 +88,13 @@ <h4>{{item.name}}</h4>
8888
Thanks to <a href="https://github.com/marak/faker.js/" target="_blank">Faker.js</a> for the generated names and <a href="http://try.buildwinjs.com/" target="_blank">WinJS</a> for the ui-dark theme.
8989
</p>
9090

91-
<script src="js/faker.min.js"></script>
92-
<script src="js/jquery.min.js"></script>
93-
<script src="js/angular.min.js"></script>
94-
<script src="js/keyboard.js"></script>
91+
<script src="js/faker/faker.min.js"></script>
92+
<script src="js/jquery/jquery.min.js"></script>
93+
<script src="js/angular/angular.min.js"></script>
94+
<script src="js/angular-keyboard/keyboard.js"></script>
9595
<script>
9696
var demo = angular.module('demo', ['keyboard']);
97-
demo.run(function ($rootScope, $timeout) {
97+
demo.run(['$rootScope', '$timeout', function ($rootScope, $timeout) {
9898
var items = [];
9999
for (var i = 0; i < 30; i++) {
100100
items.push({
@@ -111,7 +111,7 @@ <h4>{{item.name}}</h4>
111111
$timeout(function () {
112112
document.querySelector('[kb-list]').focus();
113113
}, 100);
114-
});
114+
}]);
115115
</script>
116116
</body>
117117
</html>

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
"name": "angular-keyboard",
33
"description": "Keyboard behavior for AngularJS Webapps",
44
"dependencies": {
5-
"gulp": "^3.8.9",
6-
"gulp-livereload": "^2.1.1",
7-
"gulp-noprotocol": "^0.2.1",
8-
"angular": "^1.3.0",
9-
"express": "^4.10.0",
10-
"faker": "^2.0.1",
11-
"jquery": "^2.1.1"
5+
"angular": "^1.3.14",
6+
"express": "^4.12.0",
7+
"faker": "^2.1.2",
8+
"gulp": "^3.8.11",
9+
"gulp-livereload": "^3.8.0",
10+
"gulp-noprotocol": "^0.5.2",
11+
"jquery": "^2.1.3"
1212
},
1313
"repository": {
1414
"type": "git",

src/directives/KbContainerController.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
angular.module('keyboard').factory('KbContainerController', function (undefined, $log) {
2-
'use strict';
32
/**
43
* @class KbListController
5-
* @ngInject @param {jQElement} $element
4+
* @param {jQElement} $element
65
*/
76
function KbContainerController($element) {
87
this.identifier = '[kb-container]';
@@ -13,6 +12,7 @@ angular.module('keyboard').factory('KbContainerController', function (undefined,
1312
this.active = undefined; // kbItemController of the active kb-item.
1413
this._element = $element[0];
1514
}
15+
KbContainerController.$inject = ['$element'];
1616
angular.extend(KbContainerController.prototype, {
1717
/** @lends kbListController */
1818

src/directives/KbItemController.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
angular.module('keyboard').factory('KbItemController', function (kbScroll, undefined) {
2-
'use strict';
32

43
/**
54
* @class KbItemController
6-
* @ngInject
75
* @param {jQElement} $element
86
*/
9-
return function KbItemController($element) {
7+
function KbItemController($element) {
108
this.model = undefined;
119
this.element = $element;
1210
};
13-
11+
KbItemController.$inject = ['$element'];
12+
return KbItemController;
1413
});

src/directives/kbFocus.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* <input type="text" kb-focus="label" />
99
*/
1010
angular.module('keyboard.focus').directive('kbFocus', function (kbFocus, $log) {
11-
'use strict';
1211
return function ($scope, el, attrs) {
1312
$scope.$watch(kbFocus.get, function (label) {
1413
if (label === attrs.kbFocus) {

src/directives/kbItem.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* kb-item
33
*/
44
angular.module('keyboard').directive('kbItem', function (KbItemController, $animate, $log) {
5-
'use strict';
65
return {
76
controller: KbItemController,
87
require: ['kbItem', '?^kbList', '?^kbSelect'],

0 commit comments

Comments
 (0)