Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: OauthButtonsController is not using explicit annotation and cannot be invoked in strict mode #2206

Closed
1 task done
eduardoRoth opened this issue Sep 5, 2016 · 1 comment · Fixed by #2209
Closed
1 task done
Labels

Comments

@eduardoRoth
Copy link

I've just created a new project using angular-fullstack@4.0.4.

Everything seems to work fine, except when I try to log in using the local authentication (I'd also enabled Facebook Authentication).

I get the following error every time I click on the "Login button":

OauthButtonsController is not using explicit annotation and cannot be invoked in strict mode

angular.js:13920Error: [$injector:strictdi] OauthButtonsController is not using explicit annotation and cannot be invoked in strict mode
http://errors.angularjs.org/1.5.8/$injector/strictdi?p0=OauthButtonsController
    at http://localhost:3000/vendor.bundle.js:195:13
    at Function.annotate [as $$annotate] (http://localhost:3000/vendor.bundle.js:4079:18)
    at injectionArgs (http://localhost:3000/vendor.bundle.js:4806:37)
    at Object.invoke (http://localhost:3000/vendor.bundle.js:4837:19)
    at $controllerInit (http://localhost:3000/vendor.bundle.js:10481:35)
    at nodeLinkFn (http://localhost:3000/vendor.bundle.js:9390:35)
    at compositeLinkFn (http://localhost:3000/vendor.bundle.js:8747:14)
    at compositeLinkFn (http://localhost:3000/vendor.bundle.js:8750:14)
    at compositeLinkFn (http://localhost:3000/vendor.bundle.js:8750:14)
    at nodeLinkFn (http://localhost:3000/vendor.bundle.js:9457:25)
    at compositeLinkFn (http://localhost:3000/vendor.bundle.js:8747:14)
    at compositeLinkFn (http://localhost:3000/vendor.bundle.js:8750:14)
    at compositeLinkFn (http://localhost:3000/vendor.bundle.js:8750:14)
    at compositeLinkFn (http://localhost:3000/vendor.bundle.js:8750:14)
    at publicLinkFn (http://localhost:3000/vendor.bundle.js:8627:31)
    at Object.<anonymous> (http://localhost:3000/vendor.bundle.js:38087:10)
    at http://localhost:3000/vendor.bundle.js:1374:19
    at invokeLinkFn (http://localhost:3000/vendor.bundle.js:10061:10)
    at nodeLinkFn (http://localhost:3000/vendor.bundle.js:9462:12)
    at compositeLinkFn (http://localhost:3000/vendor.bundle.js:8747:14)
    at publicLinkFn (http://localhost:3000/vendor.bundle.js:8627:31)
    at lazyCompilation (http://localhost:3000/vendor.bundle.js:8971:26)
    at updateView (http://localhost:3000/vendor.bundle.js:38005:24)
    at http://localhost:3000/vendor.bundle.js:37954:12
    at Scope.$broadcast (http://localhost:3000/vendor.bundle.js:18132:29)
    at http://localhost:3000/vendor.bundle.js:37335:23
    at processQueue (http://localhost:3000/vendor.bundle.js:16510:29)
    at http://localhost:3000/vendor.bundle.js:16526:28
    at Scope.$eval (http://localhost:3000/vendor.bundle.js:17809:29)
    at Scope.$digest (http://localhost:3000/vendor.bundle.js:17622:32)
    at Scope.$apply (http://localhost:3000/vendor.bundle.js:17917:25)
    at bootstrapApply (http://localhost:3000/vendor.bundle.js:1888:16)
    at Object.invoke (http://localhost:3000/vendor.bundle.js:4845:20)
    at doBootstrap (http://localhost:3000/vendor.bundle.js:1886:15)
    at Object.bootstrap (http://localhost:3000/vendor.bundle.js:1906:13)
    at http://localhost:3000/app.bundle.js:88:22
    at HTMLDocument.trigger (http://localhost:3000/vendor.bundle.js:3334:8)
    at defaultHandlerWrapper (http://localhost:3000/vendor.bundle.js:3624:12)
    at HTMLDocument.eventHandler (http://localhost:3000/vendor.bundle.js:3612:10) <div ui-view="" class="ng-scope">

No changes have been done to the project, as soon as the initial process finished I gulp server it and got the error.

  • I understand that GitHub issues are not for tech support, but for questions specific to this generator, bug reports, and feature requests.
Item Version
generator-angular-fullstack 4.0.4
Node 4.5.0
npm 3.10.6
Operating System OS X 10
Item Answer
Transpiler Babel
Markup HTML
CSS SCSS
Router ui-router
Client Tests Mocha
DB MongoDB
Auth Y
Facebook Y
@eduardoRoth
Copy link
Author

Solution is to $inject the $window dependency:

OauthButtonsController.$inject = ['$window'];

'use strict';

import angular from 'angular';

export function OauthButtonsController($window) {
    this.loginOauth = function(provider) {
        $window.location.href = '/auth/' + provider;
    };
}

OauthButtonsController.$inject = ['$window'];

export default angular.module('gerontopolisWebApp.oauthButtons', [])
    .directive('oauthButtons', function() {
        return {
            template: require('./oauth-buttons.html'),
            restrict: 'EA',
            controller: OauthButtonsController,
            controllerAs: 'OauthButtons',
            scope: {
                classes: '@'
            }
        };
    })
    .name;

@eduardoRoth eduardoRoth mentioned this issue Sep 5, 2016
3 tasks
@Awk34 Awk34 added the bug label Sep 6, 2016
Awk34 added a commit that referenced this issue Sep 6, 2016
Awk34 added a commit that referenced this issue Sep 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants