2016-05-13 8 views
0

erklärt a ServiceAccess Service innerhalb Controller

calculator_app.service('FullPath', function() { 
    this.full_path = function (pt, pg, prt, cd,scpe) { 

-- some logic--- 
};}); 

erklärt der Controller-

calculator_app.controller("Opportunity_Controller", ['$scope', '$http', 'ngDialog', 'FullPath', 'FillOpportunity', function ($scope, FullPath, FillOpportunity, $http, ngDialog) { 

     $scope.find_path = function() { 
      $scope.result_path = FullPath.full_path($scope.res_pt, $scope.res_pg, $scope.res_prt, $scope.res_cd, $scope); 
}]); 

Die Linie FullPath.full_path Fehler als FullPath wirft nicht definiert ist ....

Antwort

0

Abhängigkeiten bestellen sollten sei die selbe, die Art und Weise, wie du DI-Array injiziert hast, im Grunde hattest du keine Übereinstimmung bei der Injektion der Abhängigkeitssequenz.

calculator_app.controller("Opportunity_Controller", ['$scope', '$http', 'ngDialog', 'FullPath', 'FillOpportunity', 
    //corrected sequence of dependencies below 
    function ($scope, $http, ngDialog, FullPath, FillOpportunity) { 
+0

Danke. Das löst. Ich kann jedoch nicht auf ngDialog zugreifen. ngDialog ist nicht definiert, wenn ich console.log $ scope.calculate_opportunity = function (ngDialog) { ngDialog.open ({template: '

I am Ng Dialog

'}); } }]); –

+0

Ich thik Sie Havent ändern Sie den Code gründlich wie in der Antwort vorgeschlagen –

Verwandte Themen