angular / ngMigration-Forum

109 stars 7 forks source link

Why is my NgUpgrade Hybrid app not executing the body's `ng-controller` directive? #15

Open m4bwav opened 4 years ago

m4bwav commented 4 years ago

Link to Stack Exchange copy of this question

Currently I'm trying to upgrade a 'web-pack'ed angular js app to a 'web-pack'ed angular 2-based ngupgraded hybrid app. Its essentially still the same angularJs app that is wrapped in Angular 2 and then components are upgraded and downgraded with ngupgrade as necessary. I worked through and struggled a lot of issues here and there, and now I seem to have the bootstrap executing to finish and loading all the import dependencies without error.

While the routes seem to be responding, the page is not actually loading the AngularJs controller and its html templates. I wonder if this is because I use ng-controller at the top level?

Here's my body tag:
<body ng-controller="MasterCtrl" data-ng-class="{ 'logged-in': user }">

While the AngularJs Master.controller.js class is imported successfully, the interior of the MasterCtrl function itself inside the file is never hit.

Does the ngUpgrade not work with a top level ng-controller? How do I get the app to load again?

Here's my bootstrap call:

export class AppModule {
    constructor(private upgrade: UpgradeModule) {}

    ngDoBootstrap() {
        this.upgrade.bootstrap(document.documentElement, [
            ngResource,
            'ngRoute',
            'ngAnimate',
            'ngCookies',
            'ngMessages',
            'ngSanitize',
            'kendo.directives',
            'ui.bootstrap',
            'angulartics',
            'angulartics.google.analytics',
            'angulartics.application.insights',
            'snap',
            'ui.codemirror',
            'angular.app'
        ], {
            strictDi: true
            });

    }
}

What could make it so that my hybrid app will load up its infrastructure but not the html template and angularJs Controller?