$controller 继承
有的时候需要继承关系,来解决重复代码,通过$controller
就可以解决
var app = angular.module('angularjs-starter', []);
app.controller('ParentCtrl ', function($scope) {
// I'm the sibling, but want to act as parent
});
app.controller('ChildCtrl', function($scope, $controller) {
$controller('ParentCtrl', {$scope: $scope}); //This works
});
资料
Last updated
Was this helpful?