I have following controller definition:
angular.module('myapp', [ 'ngRoute' ]).config(function($routeProvider,
$httpProvider) {
[...]
})
.controller('edit', function($scope, $http, $routeParams) {
$scope.projectid = $routeParams.id;
$scope.viewer = "undefined";
$scope.mode = 'nothing';
var projectid = $routeParams.id;
})
.directive('initCesium', function(){
return {
restrict: 'AEC',
link: function(scope, element, attrs) {
if (typeof Cesium !== "undefined") {
startup(Cesium, scope);
} else if (typeof require === "function") {
require(["Cesium", "scope"], startup);
}
}
}
});
I need to send a web service request in function startup. Therefore I need to pass $http to startup in 2 places:
startup(Cesium, scope);require(["Cesium", "scope"], startup);
How can I do that?
startupis?....directive('initCesium', function($http){ ...and thenstartup(Cesium, scope, $http)or simplyangular.element(document.body).injector().get('$http')