Skip to content Skip to sidebar Skip to footer

Can't Bind To 'configuration' Since It Isn't A Known Property Of 'ng-material-multilevel-menu'

I am using ng-material-multilevel-menu plugin to create multilevel dropdown. I am following this article, but getting below runtime error Can't bind to 'configuration' since it

Solution 1:

Remove @NgModule section from this component file. Add NgMaterialMultilevelMenuModule in imports section of your app.module.ts file.

And declare appitems as global variable above the constructor like below:

exportclassProductsComponentimplementsOnInit {

  appitems: any = [];
  constructor(private employeeService: ProductService) {
  }

  ngOnInit() {

     this.appitems = [
        {
          label: 'Item 1 (with Font awesome icon)',
          faIcon: 'fab fa-500px',
          items: [
            {
              label: 'Item 1.1',
              link: '/item-1-1',
              faIcon: 'fab fa-accusoft'
            },
            {
              label: 'Item 1.2',
              faIcon: 'fab fa-accessible-icon',
              items: [
                {
                  label: 'Item 1.2.1',
                  link: '/item-1-2-1',
                  faIcon: 'fas fa-allergies'
                },
                {
                  label: 'Item 1.2.2',
                  faIcon: 'fas fa-ambulance',
                  items: [
                    {
                      label: 'Item 1.2.2.1',
                      link: 'item-1-2-2-1',
                      faIcon: 'fas fa-anchor'
                    }
                  ]
                }
              ]
            }
          ]
        },
      ];

    });
}

Solution 2:

First: Do not use var, just use it like this appitems=[...] Second: You did not declare the config variable in your controller. Third: You need to add the NgMaterialMultilevelMenuModule in the AppModule class not in the component you created.

Solution 3:

Just define config in your ProductsComponent :

config= {
    paddingAtStart:true,
    interfaceWithRoute:true,
    classname:'my-custom-class',
    listBackgroundColor:`rgb(208, 241, 239)`,
    fontColor:`rgb(8, 54, 71)`,
    backgroundColor:`rgb(208, 241, 239)`,
    selectedListFontColor:`red`,
    highlightOnSelect:true,
    collapseOnSelect:true,
    rtlLayout:false
};

Post a Comment for "Can't Bind To 'configuration' Since It Isn't A Known Property Of 'ng-material-multilevel-menu'"