mercredi 1 mars 2023

How do I successfully use jquery in emberjs

I'm attempting to change the value of an ember 'Input Helper' whenever a separate 'Input Helper' is clicked. The array of js objects is displayed in a child component as is the two Input Helpers the user interacts with. I have the actions bubble up into the template controller and handle and changes to the data there, where I would have thought the tracked objects array would update to show the new 'Input Helper' value. That isn't the case however.

I've moved onto installing the @ember/jquery add-on with

ember install @ember/jquery

and importing into my project with

import jQuery from 'jquery';

I even enabled Ember's jquery integration, even though I'm fairly certain it has been deprecated, according to this: https://rfcs.emberjs.com/id/0705-deprecate-jquery-optional-feature/After all of this is said and done, ember throws the following error:

TypeError: requireNode is not a function

Here is the full error stack:

Navigated to http://10.0.0.69:4200/add-cards
DEBUG: ------------------------------- index.js:170
DEBUG: Ember      : 4.10.0 index.js:170
DEBUG: Ember Data : 4.9.1 index.js:170
DEBUG: ------------------------------- index.js:170
GEThttp://10.0.0.69:4200/favicon.ico
[HTTP/1.1 404 Not Found 0ms]



Error occurred:

- While rendering:
  -top-level
    application
      add-cards

runtime.js:4985
Uncaught (in promise) TypeError: requireNode is not a function
    require wrap-require.js:12
    Ember 13
    resolveComponent opcode-compiler.js:194
    encodeOp opcode-compiler.js:2126
    pushOp opcode-compiler.js:2067
    <anonymous> opcode-compiler.js:1715
    compile opcode-compiler.js:417
    compileStatements opcode-compiler.js:2070
    maybeCompile opcode-compiler.js:2049
    compile opcode-compiler.js:2032
    <anonymous> runtime.js:2973
    evaluate runtime.js:1052
    evaluateSyscall runtime.js:4214
    evaluateInner runtime.js:4185
    evaluateOuter runtime.js:4178
    next runtime.js:5009
    _execute runtime.js:4996
    execute runtime.js:4971
    sync runtime.js:5054
    runInTrackingTransaction validator.js:138
    sync runtime.js:5054
    Ember 3
    inTransaction runtime.js:4090
    Ember 5
    invoke backburner.js:284
    flush backburner.js:197
    flush backburner.js:360
    _end backburner.js:801
    _boundAutorunEnd backburner.js:525
    promise callback*buildNext/< backburner.js:26
    flush Ember
    _scheduleAutorun backburner.js:967
    _end backburner.js:807
    _boundAutorunEnd backburner.js:525
    promise callback*buildNext/< backburner.js:26
    flush Ember
    _scheduleAutorun backburner.js:967
    _end backburner.js:807
    _boundAutorunEnd backburner.js:525
    promise callback*buildNext/< backburner.js:26
    flush Ember
    _scheduleAutorun backburner.js:967
    _end backburner.js:807
    _boundAutorunEnd backburner.js:525
    promise callback*buildNext/< backburner.js:26
    flush Ember
    _scheduleAutorun backburner.js:967
    _end backburner.js:807
    _boundAutorunEnd backburner.js:525
    promise callback*buildNext/< backburner.js:26
    flush Ember
    _scheduleAutorun backburner.js:967
    _ensureInstance backburner.js:958
    schedule backburner.js:651
    <anonymous> Ember
    fulfill rsvp.js:383
    resolve$1 rsvp.js:363
    initializePromise rsvp.js:465
    Ember 2
    initializePromise rsvp.js:460
    Promise rsvp.js:916
    Ember 7
    invokeCallback rsvp.js:435
    then rsvp.js:492
    <anonymous> Ember
    invoke backburner.js:282
    flush backburner.js:197
    flush backburner.js:360
    _end backburner.js:801
    end backburner.js:592
    _run backburner.js:845
    run backburner.js:627
    Ember 7
wrap-require.js:12

I wasn't able to identify what the issue was or why this would occur. There isn't much that I found relating to this specific error.




Aucun commentaire:

Enregistrer un commentaire