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
<https://github.com/angular/angular/issues/url>
Note, I have a component that is defined as follows:
*import { Component } from '@angular/core';*
*@Component <https://github.com/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).
<https://lh3.googleusercontent.com/-7AfCBPJUaMs/V6jiBKi88-I/AAAAAAAAANA/QGXTnysfb00qrb92Mag1vBhsZLkLMuahwCLcB/s1600/8-8-2016%2B3-44-55%2BPM_B.png>
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!
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.