C
C
Coder3212016-10-15 01:57:57
JavaScript
Coder321, 2016-10-15 01:57:57

How to export angular modules to es6?

I am writing an application in angulan 1.5, I want to use es6. How to properly export your modules for connection in the central. So far I'm doing this:

let myModule = angular.module('myModule ', [])

    .controller('myController', myController);

export default myModule ;

and in the main import:
import myModule from './my-module/my-module.module';

angular.module('app', ['myModule'])

But somehow there is a suspicion that this is not entirely correct, and the linter swears at unused variables. How are you doing?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Иван Герасимов, 2016-10-15
@Coder321

Тодд Мотто написал отличное руководство по использованию Angular 1.x и ES2015.
Пример:

import angular from 'angular';
import uiRouter from 'angular-ui-router';
import AppComponent from './app.component';
import ComponentsModule from './components/components.module';
import CommonModule from './common/common.module';

const AppModule = angular
  .module('app', [
    ComponentsModule,
    CommonModule,
    uiRouter
  ])
  .component('app', AppComponent)
  .name;

export default AppModule;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question