Skip to content

Commit 306dc79

Browse files
committed
Merge pull request #2423 from hypothesis/ng-annotate
Use browserify-ngannotate to provide injection annotations
2 parents 8c7074f + e7c0aa1 commit 306dc79

File tree

8 files changed

+22
-34
lines changed

8 files changed

+22
-34
lines changed

h/static/scripts/account/account-controller.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
var angular = require('angular');
22

3-
AccountController.inject = [
4-
'$scope', '$filter',
5-
'auth', 'flash', 'formRespond', 'identity', 'session'
6-
];
7-
function AccountController(
8-
$scope, $filter,
9-
auth, flash, formRespond, identity, session
10-
) {
3+
// @ngInject
4+
function AccountController($scope, $filter, auth, flash, formRespond, identity,
5+
session) {
116
var personaFilter = $filter('persona');
127

138
$scope.subscriptionDescription = {

h/static/scripts/account/account.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
var angular = require('angular');
22

3-
AuthAppController.$inject = [
4-
'$location', '$scope', '$timeout', '$window',
5-
'session'
6-
];
7-
function AuthAppController(
8-
$location, $scope, $timeout, $window,
9-
session
10-
) {
3+
// @ngInject
4+
function AuthAppController($location, $scope, $timeout, $window, session) {
115
function onlogin() {
126
window.location.href = '/stream';
137
};
@@ -38,15 +32,15 @@ function AuthAppController(
3832
}
3933

4034

41-
AuthPageController.$inject = ['$routeParams', '$scope'];
42-
function AuthPageController( $routeParams, $scope) {
35+
// @ngInject
36+
function AuthPageController($routeParams, $scope) {
4337
$scope.model.code = $routeParams.code;
4438
$scope.hasActivationCode = !!$routeParams.code;
4539
}
4640

4741

48-
configure.$inject = ['$httpProvider', '$locationProvider', '$routeProvider'];
49-
function configure( $httpProvider, $locationProvider, $routeProvider) {
42+
// @ngInject
43+
function configure($httpProvider, $locationProvider, $routeProvider) {
5044
// Use the Pyramid XSRF header name
5145
$httpProvider.defaults.xsrfHeaderName = 'X-CSRF-Token';
5246

h/static/scripts/account/auth-controller.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
AuthController.$inject = [
2-
'$scope', '$timeout',
3-
'flash', 'session', 'formRespond'
4-
];
5-
function AuthController(
6-
$scope, $timeout,
7-
flash, session, formRespond
8-
) {
1+
// @ngInject
2+
function AuthController($scope, $timeout, flash, session, formRespond) {
93
var pendingTimeout = null;
104

115
function success(data) {

h/static/scripts/config/accounts.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var angular = require('angular');
22

3-
configure.$inject = ['$httpProvider', 'identityProvider'];
4-
function configure( $httpProvider, identityProvider) {
3+
// @ngInject
4+
function configure($httpProvider, identityProvider) {
55
// Pending authentication check
66
var authCheck = null;
77

h/static/scripts/session.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,12 @@ function sessionActions(options) {
5353
*
5454
* In addition, this service also provides helper methods for mutating the
5555
* session state, by, e.g. logging in, logging out, etc.
56+
*
57+
* @ngInject
5658
*/
59+
function session($document, $http, $resource, flash) {
5760
// TODO: Move accounts data management (e.g. profile, edit_profile,
5861
// disable_user, etc) into another module with another route.
59-
session.$inject = ['$document', '$http', '$resource', 'flash'];
60-
function session( $document, $http, $resource, flash) {
6162
var actions = sessionActions({
6263
transformRequest: prepare,
6364
transformResponse: process,

h/templates/app.html.jinja2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
{% endblock %}
88

99
{% block body_tag %}
10-
<body ng-app="h" ng-controller="AppController" ng-csp="">
10+
{# ng-strict-di is a (harmless) noop until we upgrade to Angular 1.3 #}
11+
<body ng-app="h" ng-strict-di ng-controller="AppController" ng-csp="">
1112
{% endblock %}
1213

1314
{% block content %}

h/templates/auth.html.jinja2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
{% endblock %}
88

99
{% block body_tag %}
10-
<body ng-app="h" ng-controller="AuthAppController">
10+
{# ng-strict-di is a (harmless) noop until we upgrade to Angular 1.3 #}
11+
<body ng-app="h" ng-strict-di ng-controller="AuthAppController">
1112
{% endblock %}
1213

1314
{% block content %}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"babelify": "^6.1.3",
88
"base-url": "^1.0.0",
99
"browserify": "^9.0.3",
10+
"browserify-ngannotate": "^1.0.1",
1011
"browserify-shim": "^3.8.3",
1112
"clean-css": "2.2.2",
1213
"coffee-script": "1.7.1",
@@ -59,6 +60,7 @@
5960
"transform": [
6061
"strip-bomify",
6162
"coffeeify",
63+
"browserify-ngannotate",
6264
"browserify-shim"
6365
]
6466
},

0 commit comments

Comments
 (0)