简体   繁体   English

Angular中$ scope.Variable和$ scope.Function之间的差异?

[英]Differnce between $scope.Variable and $scope.Function in Angular?

$scope.some_random_variable = "random_value";
$scope.some_random_function = function(random_param){
    console.log("randomness");
} 

I want to know the difference in the context of digest cycle. 我想知道摘要周期的背景差异。 As far as I can understand scope_function changes the visibility of Angular Function. 据我所知,scope_function改变了Angular Function的可见性。

基本上,在您的html或与您的$scope交互的任何内容中,声明为函数的$scope.something将在调用时启动,就像javascript函数的工作方式一样,与变量相同,只是区别$scope和var将是$scope是全局调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM