I'm new to angular and i'm trying to use ES6.
I have a problem with dependencies inject, i can't get it to work.
My index.js :
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);
My index-state.controller.js is :
class IndexStateController { constructor($timeout) { this.$timeout = $timeout; this.controllerName = 'Example Controller'; console.log(this.$timeout); } } IndexStateController.$inject =['$timeout']; export default [ IndexStateController ];
I'm getting 'undefined' on the console.log(this.$timeout).
Can someone help me through this ?
Thanks