AngularJS:如何在控制器之间传递变量?
function Ctrl1($scope) { $scope.prop1 = "First";}function Ctrl2($scope) { $scope.prop2 = "Second"; $scope.both = Ctrl1.prop1 + $scope.prop2; //This is what I would like to do ideally}
Ctrl1
Ctrl2
function Ctrl2($scope, Ctrl1) { $scope.prop2 = "Second"; $scope.both = Ctrl1.prop1 + $scope.prop2; //This is what I would like to do ideally}
Ctrl2.prototype = new Ctrl1();
注:
鸿蒙传说
相关分类