Skip to content

import and export es6 #360

@srobledo

Description

@srobledo

Cannot export or import clases when using es6.

Exporting class:

export class authRestService
{
  constructor($resource, env) {
    this.$resource = $resource;
    this.env = env;
  }
}

Importing class and extending:

import {authRestService} from './authrest-service';

(function () {
  'use strict';

  class Auth extends authRestService {
    constructor($resource, env) {
      super($resource, env);
    }

    get() {
      return 'Auth';
    }
  }

  /**
   * @ngdoc service
   * @name components.service:Auth
   *
   * @description
   *
   */
  angular
    .module('components')
    .service('Auth', Auth);
}());

i get the following error on the console,

authrest-service.js:3 Uncaught ReferenceError: exports is not defined(…)(anonymous function)
auth-service.js:11 Uncaught ReferenceError: require is not defined(…)(anonymous function)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions