国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

angular.js - The difference between global variables in angularjs
PHP中文網(wǎng)
PHP中文網(wǎng) 2017-05-15 16:54:33
0
2
774

constant/value/js global definition What are the differences between these 3?

PHP中文網(wǎng)
PHP中文網(wǎng)

認證0級講師

reply all(2)
洪濤

1. Global variables in js exist in the entire global space, angular的兩個方法產(chǎn)生的常量只在angular的上下文中有作用。
2.angular中的constant()創(chuàng)建的是一個可以被配置的常量,而value()創(chuàng)建的是一個不可以被配置的常量。
3.具體:constant()方法可以將一個已經(jīng)存在的變量注冊為服務,然后通過依賴注入,可以注入到應用的其他部分中去,注意:產(chǎn)生的常量不可以被裝飾器攔截
4.value()方法和上面的方法基本一樣,不同之處在于:使用constant()方法產(chǎn)生的常量可以通過.config來配置,但是value()產(chǎn)生的常量不可以配置。
5.通常用value()來注冊服務對象或者函數(shù),而用constant() to configure data.

PHPzhong

http://stackoverflow.com/a/13015756/2586541

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template