I am trying to downgrade angular 2 directives to use with Angular 1.5 app. We are able to downgrade Angular 2 components , but not directives.
import { Directive, ElementRef, Input, Renderer } from '@angular/core';
import { UpgradeComponent } from '@angular/upgrade/static';
@Directive({
selector: 'myDir'
})
export class MyDirective {
constructor(public el: ElementRef, public renderer: Renderer) {
console.log('constructor');
}
ngOnInit() {
console.log("onInit");
}
}
angular.module(myapp)
.directive('myDir', downgradeComponent({ component: MyDirective }));
When i try to use the directive in Angular 1 app, it's not firing the constructor or ngOnInit.
This is how i am using it.
<myDir></myDir>