例如这样
app.controller('myCtrl', function($scope, $rootScope) {
// 将$rootScope改成其他名字就不行了。
$scope.names = ["Emil", "Tobias", "Linus"];
$rootScope.lastname = "Refsnes";
});
angular是怎么知道我第二个参数需要$rootScope?
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
温故而知新,可以为师矣。博客:www.ouyangke.com