dimanche 29 septembre 2019

Not letting me import modules in Ember js for some reason or an another

I have just started a small Ember project just to get my self familiar with it and it's causing me a headache at the moment because it just refuses to play ball with npm imports.

So i have a component that i am trying to import axios into and it just keeps saying Could not find module npm:axios and for the life of me i cant figure our why.

Here is my code

import Component from '@ember/component';
import axios from 'npm:axios';

import emailValidate from '../validators/email';

export default Component.extend({
  isValidEmail: false,
  actions: {
    onChange: function(value) {
      this.set('isValidEmail', emailValidate(value));

      if (emailValidate(value)) {

        axios.get('http://localhost:3000/users/').then(function (response) {
      // handle success
      console.log(response);
    })
  }
  },

 }
});

I have also tried import axios from 'axios'




Aucun commentaire:

Enregistrer un commentaire