AngularJS - How to reference a controller with a non-constant name [duplicate]
问题 This question already has answers here : Dynamic NG-Controller Name (3 answers) Closed 2 years ago . Let's suppose I have several controllers, controller1 , controller2 , etc. and these all take similar data but perform very different tasks. An example of such a controller would be: angular.module('myApp').controller('controller1', ['$scope', function($scope) { $scope.limit = undefined; $scope.answer = undefined; $scope.hasresult = false; $scope.run = function() { // Do some controller