Closed jaagr closed 9 years ago
Named dependencies are no longer supported in Angular Classy 1.0. I may add it later as a plugin though (in which case I will implement your feature request).
In 1.0, you could do something like:
app.classy.controller({
name: 'MyCtrl',
inject: ['$scope', '$http', '$location', 'utils.Dates'],
data: {
Dates: 'util.dates'
},
init: function() {
console.log(this.Dates); // Injected dates util
}
});
or, simply:
app.classy.controller({
name: 'MyCtrl',
inject: ['$scope', '$http', '$location', 'utils.Dates'],
init: function() {
this.Dates = this.utils.Dates;
console.log(this.Dates); // Injected dates util
}
});
Hi,
As for now I have to use the object notation if I want to rename any of the services I inject into my controller. I think it gets cluttered quickly. I know that I could use '.' to avoid repeating the service names but still doesn't look good and I think it's a shame since everything else with classy looks just... yeah, classy.
I think it would be nice if the renaming could be done when injection the dependencies using an array. Maybe something like this:
inject: ['$scope', '$http', '$location', {'utils.Dates': 'Dates'}]