Try to search your question here, if you can't find : Ask Any Question Now ?

Providers,ChangeDetection,Encapsulations,host in Angular component definitions

HomeCategory: stackoverflowProviders,ChangeDetection,Encapsulations,host in Angular component definitions
Avatarcraig asked 5 months ago

I see some packages where they give providers, encapsulations, changeDetections, host as the following piece of code. What do they mean and how does it behave in the component class with respect to the following code.

@Component({
    selector: 'ng-select',
    templateUrl: './ng-select.component.html',
    styleUrls: ['./ng-select.component.scss'],
    providers: [{
        provide: NG_VALUE_ACCESSOR,
        useExisting: forwardRef(() => NgSelectComponent),
        multi: true
    }],
    encapsulation: ViewEncapsulation.None,
    changeDetection: ChangeDetectionStrategy.OnPush,
    host: {
        'role': 'listbox',
        'class': 'ng-select',
        '[class.ng-select-single]': '!multiple',
    }
})
1 Answers
Best Answer
AvatarMannu answered 5 months ago
Your Answer

7 + 7 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com