Hey,
I am working on converting my Angular app over to Meteor after the recent announcement for full support of Angular and ES2015. However, I it seems that ES2015 classes do not work properly. Here is an example:
angular.module('gsn.home')
.controller('HomeCtrl', HomeController);
class HomeController {
/*@ngInject*/
constructor($modal) {
this.$modal = $modal;
this.loginModal = this.$modal({
show: false,
controller: 'LoginCtrl',
controllerAs: 'vm',
templateUrl: 'client/login/login.modal.ng.html',
placement: 'center',
container: 'body',
animation: 'am-fade-and-scale'
});
}
showLoginModal() {
this.loginModal.$promise.then(this.loginModal.show);
}
}
If I register the class as as a controller above the controller definition I get an error saying HomeCtrl is not defined. It is as though variable housing is not working, which may have to do with the class being converted into a function expression. But if I register the controller after the class definition I get an error saying “cannot read property ‘prototype’ of undefined.”
Previously I was using System.js and jspm to import the class into the component app file and registered the class as a controller in a very similar fashion. With meteor it doesn’t appear that there is support for ES2015 module loading. In fact, the compiler throws an error saying that ‘export’ is a reserved word.
Short of using an ES5 constructor function, how can I get Meteor and Angular to play well with ES2015 classes?