本文介绍了如何重用控制器B中控制器A中定义的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想重用控制器之间定义的代码
i would like to reuse the code defined between the controllers
.controller('GenericController', ['$scope', '$controller', '$rootScope', '$dialogs', '$state', '$http', '$modal', '$q', '$timeout', 'projectFactory', 'projectPromise', 'phaseFactory', 'buFactory', 'stakeholderGroupFactory', 'ldapFactory', 'genericFactory', 'User',
function ($scope, $controller, $rootScope, $dialogs, $state, $http, $modal, $q, $timeout, projectFactory, projectPromise, phaseFactory, buFactory, stakeholderGroupFactory, ldapFactory, genericFactory, User) {
$scope.testing = function() {
console.log("Hello");
};
}]);
推荐答案
使用 $ controller
用于导入此修复我的问题
Used the $controller
for the importing this fixed my issue
这篇关于如何重用控制器B中控制器A中定义的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!