简体   繁体   中英

Provider changes in angular 2 final version

In angular 2.0.0-rc.1 we have created Provider using new Provider, refer below code snippet

var constAccessor = new Provider(NG_VALUE_ACCESSOR, { useExisting: forwardRef(() => EJDefaultValueAccessor), multi: true });

    var valDirective = Directive({selector: selector, 
        host: { '(change)': 'onChange($event.value)', '(focusOut)': 'onTouched()' }, 
        providers: [constAccessor]
    })

Which is used to create a directive, but when porting to angular final release i am not able to find a solution. Checked change log in below location

https://github.com/angular/angular/blob/master/CHANGELOG.md

Any solutions ?

You should use map literal like:

var constAccessor = { 
   provide: NG_VALUE_ACCESSOR, 
   useExisting: forwardRef(() => EJDefaultValueAccessor), 
   multi: true 
};

See also

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