Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

bug(ngComponentRouter): Working code with Angular 1.5.0 breaks with 1.5.2 #14284

Closed
alexgoldstone opened this issue Mar 20, 2016 · 1 comment
Closed

Comments

@alexgoldstone
Copy link

I declare $routerRootComponent like this:

(function() {
    'use strict';

    angular.module('app', ['app.config', 'ngComponentRouter', 'ngIdle', 'smart-table']);

    angular.module('app').config(function($locationProvider) {
        $locationProvider.html5Mode(true);
    });

    angular.module('app').value('$routerRootComponent', 'app');
})();

I then declare the first $routeConfig like this:

(function() {
    'use strict';

    angular.module('app').component('app', {
        controller: 'AppController',
        templateUrl: 'app.html',
        $routeConfig: [
            {path: '/user/login', name: 'Login', component: 'login', useAsDefault: true},
            {path: '/admin/...', name: 'Admin', component: 'admin'}
        ]
    });
})();

The above worked fine in Angular 1.5.0 but with Angular 1.5.2 I get this error:

Failed to instantiate module app due to:
TypeError: Cannot create property '$routeConfig' on string 'AppController'
    at http://localhost:3000/app.js:1:24483
    at p (http://localhost:3000/app.js:1:1052)
    at Bc.component (http://localhost:3000/app.js:1:24434)
    at d (http://localhost:3000/app.js:1:17190)
    at http://localhost:3000/app.js:1:17296
    at p (http://localhost:3000/app.js:1:863)
    at g (http://localhost:3000/app.js:1:17091)
    at db (http://localhost:3000/app.js:1:19121)
    at c (http://localhost:3000/app.js:1:7768)
    at xc (http://localhost:3000/app.js:1:8071
@gkalpak
Copy link
Member

gkalpak commented Mar 20, 2016

Duplicate of #14279. This is indeed a bug/limitation - we're working on it.
(A temporary workaround is to not register component/directive controllers by name, but reference the actual function/Class itself.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants