0
聲明聲明服務訪問服務內部控制器
calculator_app.service('FullPath', function() {
this.full_path = function (pt, pg, prt, cd,scpe) {
-- some logic---
};});
控制器
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);
}]);
線FullPath.full_path拋出誤差FULLPATH未定義....
謝謝。解決了。但是,我無法訪問ngDialog。 ngDialog is undefined wen我做了console.log $ scope.calculate_opportunity = function(ngDialog){ ngDialog.open({template:'
I am Ng Dialog
我還沒有完全按照答案中的建議更改代碼 –