typescript - Angular2 give error Argument of type 'ElementRef' is not assignable to parameter of type 'ViewContainerRef' -
i'm creating angular2 app using angular-cli, when use constructor below give error this
error
argument of type 'elementref' not assignable parameter of type 'viewcontainerref'. property 'element' missing in type 'elementref'.
my constructor
constructor( _elementref: elementref, _loader: dynamiccomponentloader,_parentrouter: router, @attribute('name') nameattr: string, private userservice: logincomponent) { super( _elementref, _loader, _parentrouter, nameattr); this.parentrouter = _parentrouter; this.publicroutes = ['', 'login', 'signup']; }
what wrong code?. i'm using angular2 rc.3
add viewcontainerref import constructor , use using elementref.
apparently has changed , cannot pass elementref viewcontainerref.
import {component, dynamiccomponentloader, elementref, viewcontainerref} '@angular/core'; .... constructor( _elementref: elementref, _viewcontainerref: viewcontainerref, _loader: dynamiccomponentloader, ...) { super(_viewcontainerref, _loader, ...); }
Comments
Post a Comment