You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
451 B
18 lines
451 B
import { Controller } from '@hotwired/stimulus'; |
|
|
|
export default class extends Controller { |
|
static targets = ["collectionContainer"] |
|
|
|
static values = { |
|
index : Number, |
|
prototype: String, |
|
} |
|
|
|
addCollectionElement(event) |
|
{ |
|
const item = document.createElement('li'); |
|
item.innerHTML = this.prototypeValue.replace(/__name__/g, this.indexValue); |
|
this.collectionContainerTarget.appendChild(item); |
|
this.indexValue++; |
|
} |
|
}
|
|
|