Do you want to use ES6 with angular and webpack? Here is a simple project with everything what you need at the beginning
npm install angular-es6
Here is multiple examples:
export default class NiceDirective {
constructor($http) {
this.$http = $http;
this.template = '<div>{{computeName('NICE')}}</div>';
this.restrict = 'E';
this.scope = {
name: '='
};
}
link($scope, element, attrs) {
this.$scope = $scope;
$scope.computeName = suffix => computeName(suffix);
}
computeName(suffix = '') {
const $scope = this.$scope;
return 'Mr.' + $scope.name + ' ' + suffix;
}
}
NiceDirective.$inject = ['$http'];
export default class MainController {
constructor($scope) {
this.$scope = $scope;
}
}
MainController.$inject = ['$scope'];
npm run build
npm run dev