Disable a dropdownbutton in Angular Drop down button component
15 Sep 20222 minutes to read
DropdownButton component can be enabled/disabled by giving disabled
property.
To disable DropdownButton component, the disabled property can be set as true
.
import { Component } from '@angular/core';
import { ItemModel } from '@syncfusion/ej2-angular-splitbuttons';
@Component({
selector: 'app-root',
template: `<!-- To render DropDownButton. -->
<button ejs-dropdownbutton [items]='items' content='Message' iconCss='ddb-icons e-message' disabled='true'></button>`
})
export class AppComponent {
// Initialize action items.
public items: ItemModel[] = [
{
text: 'Edit'
},
{
text: 'Delete'
},
{
text: 'Mark as Read'
},
{
text: 'Like Message'
}];
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { AppComponent } from './app.component';
import { enableRipple } from '@syncfusion/ej2-base';
enableRipple(true);
/**
* Module
*/
@NgModule({
imports: [
BrowserModule,
DropDownButtonModule
],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';
enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);