0

I have one same form, where I pass data from 10 different components, including the ID of each table, I want to get from the DB the data by ID. The problem is that my code that asyncs the data is in 10 different .js controllers. For example, to get data of User from the DB, I should import /path/.../userController.js on the beginning of the script section. I parsed some string and got as result:

var path = /path/.../javascriptController

But, I get of course an error if I call on the top of the script section this:

import Controller from path; 

Is it possible to import with any way .js files like:

import Controller from {{ path }}

How do I solve this problem?

Emma
  • 27,428
  • 11
  • 44
  • 69
Joe Mash
  • 39
  • 1
  • 6
  • Could you please rephrase your question? Might be able to help if I understand it correctly. Are you trying to re-use a form in many components of Vue? Where do you want to import the scripts that you want to get dynamically? Conditional imports can be done using the require module. Please see: https://stackoverflow.com/questions/36367532/how-can-i-conditionally-import-an-es6-module/43591970 – VPaul Apr 01 '19 at 02:07

1 Answers1

0

Do you have an export default in your javascriptController.js ?

export default

David Alvarez
  • 1,226
  • 11
  • 23