Angular2 AoT - module.id is not defined while setting module.id in component

206 views
Skip to first unread message

Abhijeet Phirke

unread,
Sep 23, 2016, 10:04:34 AM9/23/16
to AngularJS
Hi, 

I am facing a challenge with Angular2 AoT and any help will be a big one for me since I am stuck.

I have a simple hello world app which has main.js, home.module.ts, home.component.ts, home.component.html and home.service.ts. This code works well using Angular2 without AoT. 

After I perform AoT and Rollup precisely as per angular.io steps in cookbook, i am getting error: "Uncaught ReferenceError: module is not defined" and I have no clue why this is happening.

My Home.Component.ts is marked like this:

@Component({
    selector
: 'rf-home',
    moduleId
: module.id,   // i m setting this module.id so that I can use relative template paths in my code. Helps in Dev env.
    templateUrl
: 'Home.component.html',
    providers
: [HomeService]
})


Someone out there, please help.

Thanks and regards,
Abhijeet Phirke

Sander Elias

unread,
Sep 23, 2016, 9:24:38 PM9/23/16
to AngularJS
Hi Abhijeet,

I'm not sure that's the culprit, but have you tried moving your provider to the ngModule?

Regards
Sander
Reply all
Reply to author
Forward
0 new messages