Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

Can the Drawer widget be used in a ngFor loop in Angular


I noticed in the documents that HTML components cannot be used directly in Angular, however, the drawer is displayed in the angular demo.

I've attemtped to use the drawer within a for loop (ngFor) and I'm unable to get it to function (i.e open the drawer).

I'm using a object's ID for the button ID :

<button id="{{listid}}_AddCard"
class="btn btn-outline btn-outline-dashed btn-outline-primary btn-active-light-primary btn-hover-rise me-5">
Add Card
</button>



and setting the data-kt-drawer-toggle using [attr.data-kt-drawer-toggle] :

<div id="kt_drawer_example_basic" class="bg-white" data-kt-drawer="true" data-kt-drawer-activate="true"
[attr.data-kt-drawer-toggle]="listid+"_AddCard""
data-kt-drawer-close="#board_view_settings_close"
data-kt-drawer-width="500px">


The ids and drawer-toggle attribute are being applied correctly, however, the drawer is not opening.


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


Hi,

In your code I don't see id attribute, it should be unique (and based on this id you have to rename 'close+toggle' attribute. Check the example from 'src/_metronic/partials/layout/activity-drawer/ActivityDrawer.tsx'.

Regards,
Keenthemes support


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(