I want to inject a javascript object into my controller. I decide to use "value" approach. This works:
//define a module
var mainApp = angular.module("mainApp", []);
//create a value object as "defaultInput" and pass it a data.
mainApp.value("defaultInput", 5);
...
//inject the value in the controller using its name "defaultInput"
mainApp.controller('CalcController', function($scope, CalcService, defaultInput) {
$scope.number = defaultInput;
...
But as soon as i use Inline Array Annotation for controller, the defaultInput argument become underfined while controller instantiation:
mainApp.controller('CalcController', ['$scope','CalcService', function($scope, CalcService, defaultInput) {
I dont want to refuse of inline instantiation since it is recommended way accroding documentation, but can't find how to inject my object in this case. Thanks!