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}Ctrl1Ctrl2
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();
注:
至尊宝的传说
鸿蒙传说
随时随地看视频慕课网APP
相关分类