Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Programmers Guide to Apache Thrift this week in the Open Source forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Angular Dynamic Menu using Material design lite  RSS feed

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to create a dynamic menu, the data is get from database for instance. Here is the https://stackblitz.com/edit/angular-dmenu project

In the dynamic-menu.component.html in the StackBlitz project there are the dynamic solution and the static solution(that is commented).

The static solution should be how the dynamic solution will be rendered after executes.
If i just run with the static solution(uncomment and commented the dynamic) everything runs as expected, but if i try with the dynamic solution the menu does not work as expected (the main buttons stays on top of each other and the submenus do not display and work properly).
Is this related with how ng-template affect the CSS styles ?
Looking through Chrome developer tools i am able to see that the class="mat-menu-item ng-star-inserted" attribute in the dynamic version is added to the button for instance and this does not happen in the static version. I have try everything but i can not get it why is this happening. And how can i fix this. I am new to Angular but i want really understands how the frameworks works

Thanks in advance

Best regards
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!