2 ms·
> There are a few workarounds but they did not seem to work properly. If anyone has suggestions on that part. Actually with angular-hybrid you do not need to u
by merb 9y ago
> There are a few workarounds but they did not seem to work properly. If anyone has suggestions on that part.
Actually with angular-hybrid you do not need to use a AngularJS entryComponent.
The only thing that needs to be AngularJS is the bootstrap component.
Also AngularJS components can be Upgraded easily and Angular2+ Components can be downgraded easily, too.
The only problems are old school Directives which can be wrapped in a component for interop or just rewritten.
You can even remove angular-hybrid when you just "upgrade" all your AngularJS code that is used in routes. (you still need to have a AngularJS rootElement and than inject a downgraded ui-view).
i.e. you can't have `bootstrap: [UIView]` however using `<root-element></root-element>` in your index.html while
root element is like that:
`.component('rootElement', {template: '<ui-view></ui-view>'})`
It sucks to create AngularJS wrapper components in Angular since you need to create two, i.e. from AngularJS component:
ng1module.component('demo', {template: 'hase'});
You need to create the following ng2+ components:
@Directive({selector: 'demo-shim'})
export class DemoShimDirective extends UpgradeComponent {
@Input() text: string;
// upgrade constructor with super call
}
and than have another which can be used in routes:
@Component({selector: 'demo', template: '<demo-shim [text]="text"></demo-shim>'})
export class DemoComponent {}
and finally you can use it happily in your Ng2StateDeclaration (P.S.: I just did that today)
- alceta 8y agoWow, great. Did not look into that before, many thanks for pointing that out.