Last active
October 6, 2015 02:18
-
-
Save JohannesFischer/295b202da73d607111bc to your computer and use it in GitHub Desktop.
AngularJS - extend controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('MyApp').controller('MyController', ['$scope', function ($scope) { | |
$scope.data = [1, 2, 3]; | |
$scope.action = function () { | |
console.log('surprise motherfucker!'); | |
}; | |
}]); | |
angular.module('MyApp').controller('MyControllerImpl', ['$scope', '$controller', | |
function ($scope, $controller) { | |
angular.extend(this, $controller('MyController', {$scope: $scope})); | |
$scope.anotherAction = function () { | |
console.log($scope.data); | |
}; | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment