Angular plugins without transpiling

Hey all,
Been following this sample plugin tutorial and I’m wondering if

writing it in the latest ES6 syntax so I need Babel to transpile that to ES5 JavaScript

is required? Or can I just write in common js without babel, etc?

Thanks!

Yes you can of course write it in ES5 as that is what babel transpiles to. I used to have a ES5 example somewhere but cannot find it.

Perhaps you’d be able to help me reconstruct a base for a few of the files? Just trying to interpret the files in other plugins…

Given all the files are at the same files system level,

./module.js
./status.js
./module.html

module.js should be more or less this?

angular.module('status',[])

status.js should be in this format?

angular.module('status',[])
	.controller('StatusCtrl', ['$scope', function ($scope) {
	    $scope.name = 'Superhero';

	}]);

module.html

   <div>
       <h3>Status Control</h3>
       {{name}}
  </div>

Thanks!

Miles
Edit : Just found this here for creating directives for future reference :

@torkel Any thoughts?

Just look at the how the ES6 plugins transpile into ES5:

Ah thanks for confirming! I kept moving the code over from the Clock panel until I understood what was going on. I ended up almost exactly the same as you’ve posted. :slight_smile:

I guess I was looking for a way to do this without putting everything through Systemjs, but we made up now and everything appears to be working – thanks!

'use strict';

System.register(['./status'], function (_export, _context) {
  var StatusCtrl;
  return {
    setters: [function (_status) {
      StatusCtrl = _status.StatusCtrl;
    }],
    execute: function () {
      _export('PanelCtrl', StatusCtrl);
    }
  };
});