I have two Angular projects. One is called App1, and other is Angular Form Editor. I want to embed Form Editor into App1 (project). How can I do this?
-
in Angular 2 you should use Angular 2 modules. If you want to build Angular 2 app into another Angular 2 app you can use the first Angular 2 app as an Angular 2 module and then import it in a second Angular 2 appsmnbbrv– smnbbrv2017-09-28 05:10:09 +00:00Commented Sep 28, 2017 at 5:10
-
So I need first to create the FormEditor App as angular2 module in my App1 project?Any example please mentioned the link.asad khan– asad khan2017-09-28 05:22:22 +00:00Commented Sep 28, 2017 at 5:22
-
How are they supposed to communicate with each other?yurzui– yurzui2017-09-28 05:28:23 +00:00Commented Sep 28, 2017 at 5:28
-
Right now I want just to embed interface of form-editor into App1.After this I will right back-end for it.So it will communicate with each other.My requirement right is to use form-editor interface into App1.asad khan– asad khan2017-09-28 05:40:12 +00:00Commented Sep 28, 2017 at 5:40
Add a comment
|
1 Answer
Build a module with App2.
This can be a complex task but there are plenty of templates out there you can use. I created this minimal module template - feel free to use it: https://github.com/angular-patterns/ng-module-template
Then create an app with App1 and import the App2 module. Make sure to declare the component from the App2 module.
import 'App2Module' from 'App2Module';
@NgModule({
imports: [App2Module],
declarations: [App2Component]
})
If you also need an app template, here is one:
https://github.com/angular-patterns/ng-app-template
It uses @ngtools/webpack for the AoT buld.