diff --git a/plop-templates/component-controller.js.hbs b/plop-templates/component-controller.js.hbs index 29f87870b..1546fb808 100644 --- a/plop-templates/component-controller.js.hbs +++ b/plop-templates/component-controller.js.hbs @@ -3,4 +3,4 @@ class {{properCase name}}Controller { constructor() {} } -export default {{properCase name}}Controller; \ No newline at end of file +export default {{properCase name}}Controller; diff --git a/plop-templates/component.js.hbs b/plop-templates/component.js.hbs index a29c3e518..0fdf32622 100644 --- a/plop-templates/component.js.hbs +++ b/plop-templates/component.js.hbs @@ -1,6 +1,9 @@ -import {{properCase name}}Controller from './{{dashCase name}}/{{camelCase name}}Controller.js' +import angular from 'angular'; +import controller from './{{dashCase name}}.controller.js' -angular.module('portainer.{{module}}').component('{{camelCase name}}', { - templateUrl: './{{camelCase name}}.html', - controller: {{properCase name}}Controller, -}); \ No newline at end of file +export const {{camelCase name}} = { + templateUrl: './{{dashCase name}}.html', + controller, +}; + +angular.module('portainer.{{module}}').component('{{camelCase name}}', {{camelCase name}}) diff --git a/plopfile.js b/plopfile.js index a5c23a347..1a36df383 100644 --- a/plopfile.js +++ b/plopfile.js @@ -25,12 +25,12 @@ module.exports = function (plop) { }, { type: 'add', - path: `{{cwd}}/{{dashCase name}}/{{camelCase name}}Controller.js`, + path: `{{cwd}}/{{dashCase name}}/{{dashCase name}}.controller.js`, templateFile: './plop-templates/component-controller.js.hbs', }, { type: 'add', - path: `{{cwd}}/{{dashCase name}}/{{camelCase name}}.html`, + path: `{{cwd}}/{{dashCase name}}/{{dashCase name}}.html`, templateFile: './plop-templates/component.html.hbs', }, ], // array of actions