error when using ES6 classes with angular services/controllers error when using ES6 classes with angular services/controllers angularjs angularjs

error when using ES6 classes with angular services/controllers


'use strict';class EditorCtrl{    constructor($scope){        this.something = "ASd";    }    foo(){    }}// Use this instead.angular.module('Editor').controller('EditorCtrl', ['$scope', function($scope) {    return new EditorCtrl($scope);}]);

As the error informs must return 'new'. This way injection will also work.Cheers.


This seems to work:

angular  .module('Editor')  .controller('EditorCtrl', () => new EditorCtrl())