简体   繁体   中英

Include angular component inside of another app

I have an angular component built with angular 1.5.*. I want to include this component inside of an existing angular application. Is that possible? Can two-way binding be accomplished this way?

I can provide more details if needed but the basic structure is this:

<div ng-app="myApp" ng-controller="myController as vm">
    <my-component selection="vm.selection">
</div>

myComponent is located in another angular module.

Right now the page just doesn't render the component at all but there are no errors. It looks like the component code is just skipped.

Inject the another module dependency in this module. Hope this will work...

Does your existing angular application run on Angular 1.5? Then it should work if you include the module that your component lives in.

If you only have angular <1.4, it won't know what a component is and it will look for a directive called myComponent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM