1 2 ngular.module('myApp') .value('apiKey','123123123'); 它們最大的區(qū)別是:常量可以注入到配置函數(shù)中,而值不行。 通常情況下,可以通過value()來注冊服務(wù)對象或函數(shù),用constant()來配置數(shù)據(jù)。 1 2 3 4 5 6 7 8 9 10 11 angular.module('myApp', []) .constant('apiKey', '123123123') .con...
www.dbjr.com.cn/article/1070...htm 2025-5-25