Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

258
Views
Los controladores Stimulus JS no se conectan a la aplicación Rails

Estoy trabajando en una aplicación Rails 7.0.2 con Ruby 3.0.2 y estoy siguiendo el tutorial de estímulo para hacer un botón de copia del portapapeles https://stimulus.hotwired.dev/handbook/hello-stimulus . Cuando presiono el botón No pasó nada y he anulado el método de conexión de mis controladores para iniciar sesión en la consola al momento de la conexión, pero no se registra nada. También recibo algunos mensajes extraños en las herramientas de desarrollo del navegador:

 Uncaught TypeError: Error resolving module specifier “application”. Relative module specifiers must start with “./”, “../” or “/”. data:28:7 Uncaught Error: Unable to resolve specifier '@rails/request.js' imported from http://localhost:3000/assets/application-234f8bed8636066fccb3be9d9c37552702ed61ecdcfeb919a52fa12d5a694d68.js

Mi controlador:

 import { Controller } from "@hotwired/stimulus" // Connects to data-controller="copy" export default class extends Controller { static targets = ["source"] connect() { console.log("connect"); alert("connect") } copy(){ navigator.clipboard.writeText(this.sourceTarget.value) } }

HTML:

 <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6" data-controller="copy"> <dt class="text-sm font-medium text-gray-500">Request URL</dt> <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2" data-copy-target="source"><%= @url %></dd> <button data-action="copy#copy">Copy!</button> </div>

¿Cómo conecto mis controladores Stimulus a mi aplicación?

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!