Hello,
I am seeing an issue, using Angular2 RC4 with a webpack implementation to bundle the code. Here is the url to the documentation that I am following:
https://angular.io/docs/ts/latest/guide/webpack.html
Note, I have a component that is defined as follows:
import { Component } from '@angular/core';
@Component({
moduleId: module.id,
selector: 'test1',
template: require('./test1.component.html')
})
export class Test1 {
public message: string = "hello from test1 component inside of App-shell";
}
In the angular app that houses the above component, I am able to import the component, add it to the list of directives, and use its selector in my HTML just fine.
However, I am trying to also share this same component with another Angular 2 app. In the second app, when I try to use the component from the first app above, I reference its transpiled js equivalent file as follows:
var test = require('../../../framework/src/app/test1/test1.component');
Note, after the above line, test does have a reference to the component correctly, and I can see the message property correctly in the console window in chrome dev tools (see below).
However, when I try to add test.Test1 to the list of directives and then use the selector in the HTML of this the second app, I see the following error in the console window:
Uncaught No Directive annotation found on Test1
Note, I did the same exact setup just fine, without using webpack, and by following the SystemJS approach (no bundling). I was able to share the first component from the first angular app with the second angular app using the identical approach mentioned above. However, when I tried to leverage webpack to bundle the code, I ran into the above issue. Other parts of the application (that don't share the component work fine), thus, I know that the implementation of webpack is correct.
FYI, I am working on a portal like app, which to the user will look and feel like one application, however, it needs to be split into smaller angular2 applications, so that each team can release its respective area/app of the portal without having to deploy the entire portal app. Additionally, certain components may be shared across apps.
Hopefully, this makes sense? Please let me know if you need further explanation.
Thanks in advance for any input or suggestions that you may have in getting this to work!