Hi there, I am currently exploring Angular and attempting to integrate ES6 into my workflow.
I seem to be facing an issue with dependency injection where I cannot seem to get it working as expected.
Here is a snippet from my index.js file:
import './index-state.css!'; import angular from 'angular'; import 'angular-ui-router'; import IndexStateController from './index-state-controller'; import indexRouteConfig from './index-route'; const dependencies = [ 'ui.router' ]; export default angular .module('index-state-component', dependencies) .controller('IndexStateController', IndexStateController) .config(indexRouteConfig);
In addition, here is the content of my index-state.controller.js :
class IndexStateController { constructor($timeout) { this.$timeout = $timeout; this.controllerName = 'Example Controller'; console.log(this.$timeout); } } IndexStateController.$inject =['$timeout']; export default [ IndexStateController ];
The issue that I am encountering is that when I attempt to log `this.$timeout`, it returns 'undefined' in the console. Can someone provide guidance on how to resolve this problem?
Your assistance would be greatly appreciated. Thank you!