Angularjs 从controller.js获取app.js中的控制器值

Angularjs 从controller.js获取app.js中的控制器值,angularjs,cordova,ionic-framework,phonegap-build,Angularjs,Cordova,Ionic Framework,Phonegap Build,有人能帮我传递变量吗 $scope.imageRepoUrl从controller.js到app.js controller.js .controller('deallistCtrl', ['$scope','deals', function($scope, deals) { $scope.title = "test"; $scope.deals = deals.payload; $scope.imageRepoUrl=$scope.$parent

有人能帮我传递变量吗 $scope.imageRepoUrl从controller.js到app.js

controller.js

.controller('deallistCtrl', ['$scope','deals', function($scope, deals) { $scope.title = "test"; $scope.deals = deals.payload; $scope.imageRepoUrl=$scope.$parent.imageRepoUrl; $scope.appWebUrl=$scope.$parent.appWebUrl; }]) app.js

.state('app.deallists', { url: "/deallists", views: { 'menuContent': { templateUrl: "templates/deallists.html", controller: 'deallistCtrl', resolve: { deals: ['$http', function($http){ return $http.get('deal/deals').then(function(response){ return response.data; }) }] } } }, })
文件名本身意义不大。app.js中有什么需要此值?如果该值是由用户提供的,则控制器可以将该值挂起到$rootScope上。这是一个带有ionic框架的phonegap应用程序,我添加了angular.module'sample.controllers',[]http://URLcontroller.js中的“;//全局变量}”,在scope的帮助下,可以在控制器方法中访问该属性$scope.$parent.appWebUrl我们需要的是获取app.js中的数据app.js中的what/where您需要此URL吗?有什么原因不能在.constant中定义它吗?谢谢@NewDev我对angular很陌生,你的输入很有帮助