Set button type dynamicaly
See original GitHub issuePlease describe the feature you would like to request.
I’m using MatButton directive as attribute like this:
<button mat-button buttonType="{{button.type}}></button>"
I want to change ‘mat-button’ directive according to ‘button.type’, for example if ‘button.type’ is ‘stroked’ then ‘mat-button’ changed to ‘mat-stroked-button’. How can to change type of button dynamicaly?
What is the use-case or motivation for this proposal?
Is there anything else we should know?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:23
- Comments:15 (4 by maintainers)
Top Results From Across the Web
Angular Material bind button type dynamically - Stack Overflow
I'm using Angular Material in my project. I want to set the button type dynamically based on a variable ...
Read more >Alpha Anywhere | Change Button Text Dynamically
The contents of a button can be dynamically set at run-time using JavaScript.
Read more >Dynamic button configuration in iOS 15 - Sarunw
We will learn how to change button configuration based on the internal changes, e.g., highlighted and selected, and external changes, e.g., your ...
Read more >Dynamic Handling of buttons in Tkinter - Plus2net
Creating buttons dynamically ... We can set a variable to any integer and based on this value , number of buttons will be...
Read more >Create dynamic HTML button element with JavaScript/jQuery
In vanilla JavaScript, you can use the document.createElement() method to programmatically create an HTML button element and set its required attributes. Then ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
<button mat-button [ngClass]="condition ? 'mat-raised-button' : 'mat-stroked-button'">Button</button>
You can also use ‘mat-flat-button’ instead of ‘mat-raised-button’ if you don’t need extra styling such as shadow.I’m using a CMS to allow adding buttons dynamically and for the button.type I’m doing something like this: