[keycloak-user] Dependency injection issues using keycloak.js adapter with AngularJs
Bartosz Andrzejczak
ba.andrzejczak at gmail.com
Fri Apr 22 05:26:16 EDT 2016
Hi Dejan,
See this: https://docs.angularjs.org/error/$injector/strictdi <https://docs.angularjs.org/error/$injector/strictdi>
Just define your dependencies explicitly like this:
angular.module(‘myModule’).controller(‘test’, [‘$scope’, function ($scope) {
...
}]);
or use ng-annotate [1] with your build system to do that for you.
[1] https://github.com/olov/ng-annotate <https://github.com/olov/ng-annotate>
> On 22 Apr 2016, at 11:11 AM, Dejan B <dejan.benedik at gmail.com> wrote:
>
> Hello,
>
> we encountered a worrisome error while developing a SPA with Angular 1.5.3 and Keycloak 1.9.1 for authentication.
> If we run the application with strict dependency injection, bootstraping will fail with the following error:
>
> Error: [$injector:modulerr] Failed to instantiate module zis due to:
> [$injector:strictdi] routerConfig is not using explicit annotation and cannot be invoked in strict mode
> http://errors.angularjs.org/1.5.4/$injector/strictdi?p0=routerConfig <http://errors.angularjs.org/1.5.4/$injector/strictdi?p0=routerConfig>
> minErr/<@http://localhost:3000/bower_components/angular/angular.js:68:12 <http://localhost:3000/bower_components/angular/angular.js:68:12>
> annotate at http://localhost:3000/bower_components/angular/angular.js:3903:1 <http://localhost:3000/bower_components/angular/angular.js:3903:1>
> injectionArgs at http://localhost:3000/bower_components/angular/angular.js:4626:21 <http://localhost:3000/bower_components/angular/angular.js:4626:21>
> invoke at http://localhost:3000/bower_components/angular/angular.js:4657:18 <http://localhost:3000/bower_components/angular/angular.js:4657:18>
> runInvokeQueue at http://localhost:3000/bower_components/angular/angular.js:4558:11 <http://localhost:3000/bower_components/angular/angular.js:4558:11>
> loadModules/<@http://localhost:3000/bower_components/angular/angular.js:4567:11 <http://localhost:3000/bower_components/angular/angular.js:4567:11>
> forEach at http://localhost:3000/bower_components/angular/angular.js:322:11 <http://localhost:3000/bower_components/angular/angular.js:322:11>
> loadModules at http://localhost:3000/bower_components/angular/angular.js:4548:5 <http://localhost:3000/bower_components/angular/angular.js:4548:5>
> createInjector at http://localhost:3000/bower_components/angular/angular.js:4470:19 <http://localhost:3000/bower_components/angular/angular.js:4470:19>
> bootstrap/doBootstrap at http://localhost:3000/bower_components/angular/angular.js:1746:20 <http://localhost:3000/bower_components/angular/angular.js:1746:20>
> bootstrap at http://localhost:3000/bower_components/angular/angular.js:1767:1 <http://localhost:3000/bower_components/angular/angular.js:1767:1>
> zisStartup/<@http://localhost:3000/app/index.run.js:110:9 <http://localhost:3000/app/index.run.js:110:9>
> createPromise/p.setSuccess at http://localhost:3000/bower_components/keycloak/dist/keycloak.js:714:25 <http://localhost:3000/bower_components/keycloak/dist/keycloak.js:714:25>
> Keycloak/kc.init/<@http://localhost:3000/bower_components/keycloak/dist/keycloak.js:96:17 <http://localhost:3000/bower_components/keycloak/dist/keycloak.js:96:17>
> createPromise/p.setSuccess at http://localhost:3000/bower_components/keycloak/dist/keycloak.js:714:25 <http://localhost:3000/bower_components/keycloak/dist/keycloak.js:714:25>
> authSuccess at http://localhost:3000/bower_components/keycloak/dist/keycloak.js:518:36 <http://localhost:3000/bower_components/keycloak/dist/keycloak.js:518:36>
> processCallback/req.onreadystatechange at http://localhost:3000/bower_components/keycloak/dist/keycloak.js:490:29 <http://localhost:3000/bower_components/keycloak/dist/keycloak.js:490:29>
>
> Without strict DI, the application runs fine, but the issue occurs every time we try to run minified code.
> How could we solve this problem?
>
> Cheers, Dejan
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160422/75c33c3c/attachment.html
More information about the keycloak-user
mailing list